Reputation: 1
I need a regular expression which will limit alphanumeric values and unlimited number of numeric values.
I have tried this
/^[a-zA-Z]{3,}$/ which will limit characters.
And also
/^\d+$/ which will check for the numeric values ...
But I need to add another condition like unlimited numeric values. I need it in a single regexp.
Upvotes: 0
Views: 290
Reputation: 33153
^(\d*[a-zA-Z]\d*){3,}$
Which is three characters a-z surrounded by any amount of numbers, matching strings like "12a34b567c".
To check for alphanumeric (a-z + numbers):
^(\d*[a-zA-Z0-9]\d*){3,}$
And, this is assuming the characters can be in any order (i.e. not starting with 3 alphanumeric characters, followed by numbers only).
Upvotes: 2