Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regular expression for Dutch phone number

I'm looking for a regular expression to match a Dutch phone number. These are the formatting requirements:

  • Should start with 0
  • Contains maximum of 1 (optional) dash "-" character, for now it does not matter where it is, as long as it's not the first character
  • Total length 10 or 11 characters

This is what I've come up with so far:

^0+-{1}?([0-9]{10,11})$
like image 233
Adam Avatar asked Jul 30 '13 14:07

Adam


3 Answers

I have seen this before at http://regexlib.com/Search.aspx?k=phone%20number Check this website out, hope it helps.

(^\+[0-9]{2}|^\+[0-9]{2}\(0\)|^\(\+[0-9]{2}\)\(0\)|^00[0-9]{2}|^0)([0-9]{9}$|[0-9\-\s]{10}$)

Regular expression to evaluate dutch-style phone numbers. Possible example prefixes: +31, +31(0), (+31)(0), 0, 0031 followed by 9 numbers (which can contain a space or -).

like image 191
Raj Avatar answered Oct 19 '22 11:10

Raj


I came up with this creation

^(?:0|(?:\+|00) ?31 ?)(?:(?:[1-9] ?(?:[0-9] ?){8})|(?:6 ?-? ?[1-9] ?(?:[0-9] ?){7})|(?:[1,2,3,4,5,7,8,9]\d ?-? ?[1-9] ?(?:[0-9] ?){6})|(?:[1,2,3,4,5,7,8,9]\d{2} ?-? ?[1-9] ?(?:[0-9] ?){5}))$

like image 34
André Avatar answered Oct 19 '22 13:10

André


Try this regex: ^(?=^.{10,11}$)0\d*-?\d*$

like image 41
Brian Stephens Avatar answered Oct 19 '22 13:10

Brian Stephens