I'm trying to exract phone numbers from a set of data. It has to be able to extract international and local numbers from each country.
The rules I've laid out for it are: 1. Look for the international symbol, indicating it's an international dialing number with a valid extension(from +1 to +999). 2. If the plus symbol is present, make sure the next following character is a number. 3. If there is none, look at the length to validate it is between 7 and 10 digits long. 4. In the event that the number is divided (correctly via international standers) by either a hyphen(-) or space make sure the amount of digits in between them are either 3 or 4
What I've got so var is:
\+(?=[1-999])(\d{4}[0-9][-\s]\d{3}[0-9][-\s]\d{4}[0-9])|(\d{7,11}[0-9])
That's for international, and the local search is\d{7,10}
The thing is, that it doesn't actually pick up numbers with spaces or hyphens in it. Can anybody give me some advice on it?