Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
161
rated 0 times [  167] [ 6]  / answers: 1 / hits: 150331  / 13 Years ago, sun, october 23, 2011, 12:00:00

I need a regular expression that validate for a number with length 4, 5, 6


I used ^[0-9]{4} to validate for a number of 4, but I do not know how to include validation for 5 and 6.


More From » regex

 Answers
6

Try this:



^[0-9]{4,6}$


{4,6} = between 4 and 6 characters, inclusive.


[#89486] Thursday, October 20, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
naya

Total Points: 60
Total Questions: 87
Total Answers: 87

Location: Guam
Member since Fri, Jun 18, 2021
3 Years ago
;