Most cell phones in the US don't require it, and it'll start to baffle the younger generation unless they've dialed internationally.You've correctly identified that it's a tricky problem...So far, it's been working with everything they've thrown at it, but if errors come up, I'll update this answer.
-Adam After reading through these answers, it looks like there wasn't a straightforward regular expression that can parse through a bunch of text and pull out phone numbers in any format (including international with and without the plus sign).
Here's what I used for a client project recently, where we had to convert all phone numbers in any format to tel: links.
If you are trying to validate user input, why not normalize the result and be done with it?
If the user puts in a number you can't recognize as a valid number, either save it as inputted or strip out undailable characters.
I'm not the original author, but I think it's well worth sharing as I found this problem to be very complex and without a concise or widely useful answer.
The following regex will catch widely used number and character combinations in a variety of global phone number formats: Positive: 42 555.123.4567 1-(800)-123-4567 567 7(926)1234567 (926) 1234567 792612345567 9261234567 1234567 123-4567 123-89-567 469 123 45 67 89261234567 8 (926) 1234567 926.123.4567 415-555-1234 650-555-2345 (416)555-3456 2 4035555678 1 4 Negative: 926 3 4 8 800 600-APPLE Original source: I believe the Number:: Phone:: US and Regexp:: Common (particularly the source of Regexp:: Common:: URI:: RFC2806) Perl modules could help.
The question should probably be specified in a bit more detail to explain the purpose of validating the numbers.
For instance, 911 is a valid number in the US, but 911x isn't for any value of x.
That's so that the phone company can calculate when you are done dialing. But your regex doesn't check the area code portion, so that doesn't seem to be a concern.