0

I am using JQuery Validation Engine, and I'd like to prevent any phone number in a text field.

I have this expression, which matches any French phone numer :

((\+|00)33\s?|0)[1-9](\-?\.?\s?\d{2}){4}

It matches the numbers like that:

0102030405, 01.02.03.04.05, 01-02-03-04-05, +33102030405, 0033102030405, etc...

But I need to invert this matchs, and this does not work :

!(((\+|00)33\s?|0)[1-9](\-?\.?\s?\d{2}){4})
Jibeji
  • 453
  • 4
  • 14

1 Answers1

1

You can invert the regular expression using a negative lookahead:

^((?!((\+|00)33\s?|0)[1-9](\-?\.?\s?\d{2}){4}).)*$

See also: https://stackoverflow.com/a/38846455

ausi
  • 7,253
  • 2
  • 31
  • 48