Regular Expression for Phone Numbers

I was looking out for Regular Expressions for validating Phone Numbers of different countries. Here are some of them:

French Phone Number - (0( \d\d ))?\d\d \d\d(\d \d \d\d )\d\d

German Phone Number - ((\(0\d\d\) (\(0\d{3}\) )?\d )?\d\d \d\d \d\d\(0\d{4}\) \d \d\d-\d\d?)

Japanese Phone Number - (0\d{1,4}-\(0\d{1,4}\) ?)?\d{1,4}-\d{4}

P.R.C Phone Number - (\(\d{3}\)\d{3}-)?\d{8}

U.S Phone Number - ((\(\d{3}\) ?)(\d{3}-))?\d{3}-\d{4}

P.S: I did not create these regular expressions. If you are using ASP.NET and Visual Studio 2008/2010, you can easily get these expressions by dropping a RegularExpression Validator and browsing through the Regular Expression Editor ( Select the Validator > Properties > ValidationExpression)

Regex phone number

If you are looking out for some more Regular Expressions, check out these two sites with plenty of resources on it Regular-Expression.info and RegularExpressionLibrary






About The Author

Suprotim Agarwal
Suprotim Agarwal, Developer Technologies MVP (Microsoft Most Valuable Professional) is the founder and contributor for DevCurry, DotNetCurry and SQLServerCurry. He is the Chief Editor of a Developer Magazine called DNC Magazine. He has also authored two Books - 51 Recipes using jQuery with ASP.NET Controls. and The Absolutely Awesome jQuery CookBook.

Follow him on twitter @suprotimagarwal.

1 comment:

Beben said...

your blog its a great one in tell abour jquery plugin
i love your blog, so cleary on explanation...salom from bandung blogger Indonesia
By the way where do you come from...hehehe :D