开发者

How to tell my RegularExpressionValidator to allow Numbers, Letters, and Spaces only?

I am using: ValidationExpression="^[0-9开发者_Go百科a-zA-Z]+$" to try and only allow letters and numbers with no symbols.

Yet when I enter a phrase into the box that includes a space, it fails to validate. So I'm guessing I need to explicitly allow spaces too? Example of a search that is not working:

"Summer holiday"


Just add the space?

^[0-9a-zA-Z ]+$


very easy:-

\w+[a-zA-Z\s]+$ for Characters only

\w+[0-9a-zA-Z\s]+$ Alpha Numeric


You must include in [..] spaces. Space, tabulate, etc.. have symbol \s, so you regex: ^[0-9a-zA-Z\s]+$

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜