RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Universal Validation for phone numbers
Expression
var phonePattern = /^(([^\.\-\,a-wy-z]([\(]?(\+|[x])?\d+[\)]?)?[\s\.\-\,]?([\(]?\d+[\)]?)?[\s\.\-\,]?(\d+[\s\.\-\,]?)+[^\.\-\,a-z])|((\+|[x])?\d+))$/i
Description
This pattern will address almost most of the country phone patterns like UK, US, eurpoe, india etc.
Matches
201-654-5932 | 201 654 5932 | (201)-654-5932 | 201.654.5932 | X201.654.5932 | +1 201.654.5932 | 1.123.123.123 | 020 1234 5678 | 02-9323-1234 | (02) 9323 1234 | 1-561-555-1212 | 12345-1234 | (913) 451-6461 | (+447222)555555 | +44 7222 555 555 | +91-98-44111112 | +91-9844111112 | +44(7222)555555 | 1(240) 652-5009 | (0833)1234567-8888 | +974-584-5656 | +44 07222 555555 | 1.2123644567 | 1-(212)-123 4567 | 1212-364,4321 | 0-212364345 | (658)154-1122 | 123131312312 | 875 (489 1568) | (+91)(240) 652-5009
Non-Matches
+()- | (+)-,. | 493 -- 3227341 | 240/752-5009 | (+91)(240)(876867) 652-5009 | +974-5dadad32d84-5656 | ++44 07222 555555 | 0-234.567/8912 | 0212\345/6789 | 652-5009. | 652-5009- | 652-5009, | .652-5009 | -652-5009 | ,652-5009 | 1-800-ALPHNUM | a-12-3 | (658 154 1122 | 658 154 1122) |
Author Rating: The rating for this expression. Sumit Kumar
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials