Reputation: 11304
My text box accept alphanumeric 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.
Upvotes: 1
Views: 861
Reputation: 10508
/[a-zA-Z]+[0-9]+/
Should be what you need
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.
Upvotes: 4