,.?/ (If i need to detect more than these can I simply add them into the regexp later?)" />
开发者

Regular expression to detect few non characters

开发者 https://www.devze.com 2023-01-15 22:07 出处:网络
How do i do a regular expression that will allow everything except !@$%^&*()_+={}[]|:\";\'<>,.?/ (If i need to detect more than these can I simply add them into the regexp later?)

How do i do a regular expression that will allow everything except !@$%^&*()_+={}[]|:";'<>,.?/ (If i need to detect more than these can I simply add them into the regexp later?)

I intend using this to check if these character are present in postal addresses a user submits. So if they were there, I could reject the address.

开发者_开发百科

Thanks


You should include allowed characters instead of excluding almost everything :

[\w+-]*

But if you want to really exclude those chars :

[^!@$%^&*()_+={}\[\]|\:";'<>,.?/]*

Resources :

  • regular-expressions.info - Character Classes or Character Sets
0

精彩评论

暂无评论...
验证码 换一张
取 消