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.
^[0-9]{4}
Try this:
^[0-9]{4,6}$
{4,6} = between 4 and 6 characters, inclusive.
{4,6}
2.1m questions
2.1m answers
60 comments
56.9k users