Possible Duplicate:
A comprehensive regex for phone number validation
I've spent about two days searching for a regex that will find international phone numbers (using in scraping script), but I've run into a few problems..
- I don't know the format(s), if they are similar lengths, etc..
- I suck at complex regex
I had something that I thought worked, but then I saw a phone number from the UK that had a (0) before the 'area' code, which I've been told is not super common, but is used for within/outside numbers..
So what I need is a regex to be used in my Ruby script that will detect as many International phone numbers as possible, which accounts for this '(0)', and the possibility of a '+' in front of country code...
Because this is for scraping, and I can assume people enter phone numbers in a formatted way, I can expect a space, a ., or a - in between the area code and last 4 digits..
EDIT - This is what I tried, and wasn't getting results with which led me here..
/((\+\d{1,3})[- .]?(\d{2})[- .]?)(\d{3,4})[- .]?(\d{4})/