user584018
user584018

Reputation: 11304

Need Alphanumeric Regex

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

Answers (1)

rockerest
rockerest

Reputation: 10508

/[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.

Upvotes: 4

Related Questions