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 and RegularExpressionLibrary

Will you give this article a +1 ? Thanks in advance

About The Author

Suprotim Agarwal
Suprotim Agarwal, ASP.NET Architecture MVP (Microsoft Most Valuable Professional) works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He is the Editor of a Developer Magazine called DNC Magazine. He has also written two EBooks 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