简体   繁体   English

正则表达式,字母数字,少数特殊字符,没有其他字符

[英]Regular expression, alphanumeric, few special character and no others

First of all pardon me with my English grammar. 首先请原谅我的英语语法。 Anyway, I am trying to create a regular expression which contains alpha numeric characters including spaces, comma, full stop, exclamation point and question mark, but other characters and symbols are not allowed. 无论如何,我正在尝试创建一个包含字母数字字符的正则表达式,包括空格,逗号,句号,感叹号和问号,但不允许使用其他字符和符号。

Would this regular expression work? 这个正则表达式有用吗?

'/[^a-zA-Z\s,!?]$'

Thank you so much for the help 非常感谢你的帮助

试试这个/^[a-zA-Z0-9\\s\\.,!?]*$/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM