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

Share:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • DZone
  • LinkedIn
  • Reddit
  • StumbleUpon
  • Twitthis
This entry was posted in ASP.Net, Misc Ramblings, Syndicated, Visual Studio. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam Protection by WP-SpamFree