Reputation: 6050
I want a regular expression that accepts numeric only between 15 to 17 digits.
Upvotes: 4
Views: 4542
Reputation: 138147
^\d{15,17}$
- For any digit (use [0-9]
instead of \d
to avoid Unicode characters, if applicable).
^[1-9]\d{14,16}$
- If you don't want the number to start with all zeros.
Of course, it might be easier to parse the number and check it, it fits nicely in a long
value.
Upvotes: 7