I’m trying to narrow the following regular expression:
/\b([0-9]{22})\b/
to only match 22 digit numbers that don’t start with "91". Anyone know how to do this?
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.
If your regexp engine has zero width negative lookahead, then:
(?!91)causes the pattern to match only if the next two characters are not 91, but does not consume those characters, leaving them to be matched by[0-9]{22}.Many regexp engines also allow
\dfor decimal digits. If yours does, then: