regex - Regular expression dutch mobile number or international number -


i use regular expression validate dutch mobile phone number:

^((\+316|06|00316){1}\\s?-?\s?[1-9]{1}[0-9]{7})$

so number should start 06 or +316 or 00316 followed 8 digits (not starting 0)

now have extend validation allows international numbers outside netherlands.

i want keep simple thinking:

if not starts 06 or +316 or 00316 should start '00dd' or '+dd' dd!=31 followed 8 till 12 digits.

so 0032127384562 should match 00317198765432 not (because starts 0031 not 00316)

does know how this?

the regex international number is:

^00(?!31)[0-9]{2}\s?-?\s?[1-9][0-9]{7,11}$ 

or, if can't use lookahead:

^00([0-24-9][0-9]|3[02-9])\s?-?\s?[1-9][0-9]{7,11}$ 

you can concatenate | , dutch regex.

be aware there typo in regex @ \\.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -