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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details RegEx that match all most all Telephone number pattern
Expression
preg_match_all("/([\(\+])?([0-9]{1,3}([\s])?)?([\+|\(|\-|\)|\s])?([0-9]{2,4})([\-|\)|\.|\s]([\s])?)?([0-9]{2,4})?([\.|\-|\s])?([0-9]{4,8})/",$string, $phones);
Description
This expression matches all following Telephone number patterns [US Telephone, Indian Telephone, Canadian Telephone & Fax Numbers]. I tested it and its working fine. and hope this will be helpful to u people. suggestion are welcome ! +91-80-1234567 | +91 80 1234567 | +91 80-1234567 | +91-80 1234567 | +91.80.1234567 | +91.80-1234567 | +91-80.1234567 | (91)80-1234567 | (91)80 1234567 | (91)80.1234567 | +91-80-12345678 | +91 80 12345678 | +91 80-12345678 | +91-80 12345678 | +91.80.12345678 | +91.80-12345678 | +91-80.12345678 | (91)80-12345678 | (91)80 12345678 | (91)80.12345678 | +91-484-1234567 | +91 484 1234567 | +91 484-1234567 | +91-484 1234567 | +91.484.1234567 | +91.484-1234567 | +91-484.1234567 | (91)484-1234567 | (91)484 1234567 | (91)484.1234567 | +91-484-12345678 | +91 484 12345678 | +91 484-12345678 | +91-484 12345678 | +91.484.12345678 | +91.484-12345678 | +91-484.12345678 | (91)484-12345678 | (91)484 12345678 | (91)484.12345678 | +123-123-1234 | +123 123 1234 | +123 123-1234 | +123-123 1234 | +123.123.1234 | +123.123-1234 | +123-123.1234 | (123)123-1234 | (123)123 1234 | (123)123.1234 | +123-123-1234 | +123 123 1234 | +123 123-1234 | +123-123 1234 | +123.123.1234 | +123.123-1234 | +123-123.1234 | (123)123-1234 | (123)123 1234 | (123)123.1234 | 123-123-1234 | 123 123 1234 | 123 123-1234 | 123-123 1234 | 123.123.1234 | 123.123-1234 | 123-123.1234 | 123-123-1234 | (001)456-789-1234 | 001-456-789-1234 | 4841801234 | +91.1234567890 | +91-1234567890 | +91 1234567890 | 1-561-555-1212 | 1234567890 | 1234-1234567 | 123-12345678 (05)12341234 | 09886657989 - Phone , Telephone "+91 80 2559 4800" and "91 (80) 234 65453"
Matches
all phone numbers
Non-Matches
i couldnt find any
Author Rating: The rating for this expression. Unnikrishnan
   Displaying page 1 of 1 pages; Items 1 to 1

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