需要帮助创建一个简单的正则表达式

时间:2012-12-05 17:39:53

标签: regex

我需要一个验证字符串(字母,数字,空格或特殊字符)的正则表达式,但不能包含大于35个字符的单词,例如:

有效:这是一个测试字符串

无效:这是一个testtttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt衣线

谢谢

1 个答案:

答案 0 :(得分:1)

[a-zA-Z0-9~@#\^\$&\*\(\)-_\+=\[\]\{\}\|\\,\.\?\s]{,35}  

您可以根据需要添加其他special characters