regex to match everything except 2 digits -


i'm having problem regex matches except 2 digits in middle.

example:

input : 40442**75**22123456

match : 75

allow: 4044273xxxxxxxx, 4044255xxxx etc..

the expression have is: [0-9]{5}[0-68-9]{1}[0-46-9]{1}[0-9]{8}

it works exact match fails exception cases.

if want allow 75 in spot, use alternation.
put exceptions in alternation. there overlap,
there not allowed.
if it's case ones not allowed few, use general
range negative assertion, disallow some. i.e.[0-9]{2} (?<!52|74)

[0-9]{5}(?:[0-68-9][0-46-9]|75)[0-9]{8}

expanded

 [0-9]{5}   (?:       [0-68-9]        [0-46-9]     |  75    |  [0-9]5    |  etc...  )  [0-9]{8}  

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -