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



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




About The Author

Suprotim Agarwal, ASP.NET Architecture MVP 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 has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

1 Response to "Regular Expression for Phone Numbers"
  1. Beben said...
    March 9, 2010 at 12:13 PM

    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

 

Copyright © 2009-2014 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions