简体   繁体   中英

How to validate a text field with regular expression

我想验证一个以数字或字母开头的文本字段,但不是通过正则表达式来验证任何特殊符号,如(!@#etc.)。

尝试这样^[a-zA-Z0-9][a-zA-Z0-9@#$%^&*]*这允许以a-zA-Z0-9开头的字符串和第二个括号中给出的字符

^[0-9A-Za-z]

\\w表示单词字符: [a-zA-Z_0-9]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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