Reputation: 17000
I have a telephone number checking regex:
/^\+\d{1,3}[\d ]*$/
(it matches +7 5165761074
).
I need this regexp also not to allow 0000000
and 1234567
inside.
Upvotes: 0
Views: 45
Reputation: 6882
You could use negative lookahead
/^\+(?!0000000)(?!1234567)\d{1,3}[\d ]*$/
http://www.javascriptkit.com/javatutors/redev2.shtml
The actual expression in the lookaheads might be slightly different depending on what exactly you mean with "not allow inside".
Upvotes: 3