-4
(00355) XX-XXX-XXXX

So far I have this but I don't know how to express that first five digits must be 00355.

/^.d{2}.\d{3}.\d{4}.$/
Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
rei koleci
  • 68
  • 1
  • 7
  • 1
    Possible duplicate of [A comprehensive regex for phone number validation](http://stackoverflow.com/questions/123559/a-comprehensive-regex-for-phone-number-validation) – Tot Zam Dec 08 '16 at 15:43
  • Also a duplicate of http://stackoverflow.com/questions/3090862/how-to-validate-phone-number-using-php – Tot Zam Dec 08 '16 at 15:44

3 Answers3

1

In case you want to give the user more flexibility:

http://www.phpliveregex.com/p/i9u

preg_match("/(00355\s\d{2}[-|\s]\d{3}[-|\s]\d{4})/", $input, $output);
Andreas
  • 23,610
  • 6
  • 30
  • 62
1

Try this one:

#^\(00355\) \d{2}-\d{3}-\d{4}$#

https://regex101.com/r/d9ktJf/1

It will basicly check for string which starts with 00355 then has space then 2 numbers then - then 3 numbers then - and end with 4 numbers # is used as delimiter.

Robert
  • 19,800
  • 5
  • 55
  • 85
0
/\(00355\)\s\d{2}-\d{3}-\d{3}/

should do the trick.

btw - try this tool: https://regex101.com/

Jameson the dog
  • 1,796
  • 1
  • 11
  • 12