I am having problems with regular expression for phone numbers. I am trying to create a regular expression that is as high as possible for European phone numbers. A phone number can begin with a + or two leading 0 characters, followed by a number from 0 to 40. This is optional, so this first part can also be ignored. After that, everyone should be numbers grouped in pairs of at least two, with a space or a-inbetween groups.
The regular expression that I have compiled can be found below.
/((\+|00)+[0-4]+[0-9]+)?([ -]?[0-9]{2,15}){1,5}/
This should be consistent with the following structures
0031 34-56-78 0032123456789 0033 123 456 789 0034-123-456-789 +35 34-56-78 +36123456789 +37 123 456 789 +38-123-456-789 ...
That it also matches according to my javascript
+32 a54b 67-0:
So I must have made a mistake, but I really can't see it. Any help would be greatly appreciated.
source share