I need to check by Regex expression if 9 or 14 digits are typed.
The expression \d{9}|\d{14} seems to be not working properly, what’s wrong ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This regex should work.
Could you post the piece of code you’re using and tell us what language are you using?
If you’re using regex chances are that you have a string, and I’m sure your language has something to count string length.
EDIT:
as Rubens Farias pointed out in comments maybe ^…$ is needed because your regex would match any number with more than 9 digit as that number has a substring with a 9 digit long number.
Anyway check if you can do it with your language’s string’s methods/functions