This is a very difficult task as phone numbers are written differently nearly in each country.

validating steam games-77validating steam games-58

I never get inconsistent results when dialing numbers using the PSTN.

For example, in the US (where mobile phones have the same area codes as landlines, I could dial 1-123-456-7890, or 011-1-123-456-7890 (where 011 is the international dialing prefix in the US and 1 is the international dialing code for the US), 1-123-456-7890 (where 1 is the local dialing prefix in the US) or even 456-7890 (assuming I was in the 123 area code at the time) and get the same results each time.

Sort regexps by more specific first and then take the first which succeeds in parsing.

In some countries you can validate 112 as a valid phone number, but if you stick a country code in front of it it won't be valid any more.

I've seen some phones that put Q and Z on the 0 key, and some that put Q and Z on the 1 key.

An area code that existed yesterday might not exist today, and vice-versa.

For what it's worth, the telephone network itself doesn't always use E.164.

Often there'll be a flag in the ISDN signalling generated by the PBX (or in the network if you're on a steam phone) which tells the network whether the number being dialled is local, national or international.

In Australia, the valid area codes for landlines and mobile (cell) phones are two digits (the first is 0). its douze (twelve), trente-quatre (thirty four), ...

Do you want to cater for that level of cultural difference?

NATIONAL)); // Produces " 41446681800" println(phone Util.format(swiss Number Proto, Phone Number Format.