So I am trying to match with any 5 digits number other than 10000,11000,68000. With negative lookbehind, lookaround etc. this code does exactly what I want
^[0-9]{5}(?<!10000|11000|68000)$
.However, I would like to do it without using lookbehind. Is there any nice way to do it?
Thank you!
This will match all 5 digit numbers excluding your few listed
excludes numbers 10000, 11000, and 68000
The ranges are:
00000 - 09999
10001 - 10999
11001 - 67999
68001 - 99999
^(?:0\d{4}|(?:1000[1-9]|100[1-9]\d|10[1-9]\d{2})|(?:1100[1-9]|110[1-9]\d|11[1-9]\d{2}|1[2-9]\d{3}|[2-5]\d{4}|6[0-7]\d{3})|(?:6800[1-9]|680[1-9]\d|68[1-9]\d{2}|69\d{3}|[7-9]\d{4}))$
viewing
^
(?:
0 \d{4}
| (?:
1000 [1-9]
| 100 [1-9] \d
| 10 [1-9] \d{2}
)
| (?:
1100 [1-9]
| 110 [1-9] \d
| 11 [1-9] \d{2}
| 1 [2-9] \d{3}
| [2-5] \d{4}
| 6 [0-7] \d{3}
)
| (?:
6800 [1-9]
| 680 [1-9] \d
| 68 [1-9] \d{2}
| 69 \d{3}
| [7-9] \d{4}
)
)
$