开发者

Need Alphanumeric Regex

开发者 https://www.devze.com 2023-03-06 18:50 出处:网络
My text box accept alp开发者_如何学Gohanumeric and on submit button click I need to make sure that textbox contains should at least 1 char (a-z|A-Z) and 1 digit (0-9).

My text box accept alp开发者_如何学Gohanumeric and on submit button click I need to make sure that textbox contains should at least 1 char (a-z|A-Z) and 1 digit (0-9).

Please help me in regex pattern.


/[a-zA-Z]+[0-9]+/ Should be what you need

edit

Here's one that takes either alpha->numeric or numeric->alpha:

([a-zA-Z]+[0-9]+)|([0-9]+[a-zA-Z]+)

Note that you need to match_all because this will match each group of letter-number and number-letter as individual matches.

0

精彩评论

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