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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find 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
Source Self written
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

Title: Some telephone numbers that do not match correctly
Name: Ceriel
Date: 5/17/2008 8:53:06 AM
Comment:
Tel. +31 (0)20 6659398 Tel2 (030) 1234567 Mob. +31 (0)6 22779424 Tel3 0031 485 453734 Fax. +1 (0)20 6947819 # Kruislaan 400 0321-123456 # Tel: 020 46 88 071 010-1234567 Telefon 030 - 84 59 08 - 0 Telefax 030 - 84 59 08 - 33 Telefon +49 (0)180 / 5927801-0 (0.12 Euro / Min) Telefax +49 (0)180 / 5927801-9 (0,12 Euro / Min) Telefon: +49 (0)201 / 958 607-0 Telefax: +49 (0)201 / 958 607-99 Support-Nr.: +49 (0)201 / 958 607-0 oder telefonisch unter 0180/5927801-0, beraten lassen. Telefoon: 089/72.24.67 Telefax: 089/72.25.30 Tel. & Fax. +32 (0)9 227 62 46 Tel. +32 (0)9 223 88 53 - +32 (0)9 229 17 16 Tel.: 0478 63 36 30 Fax: 09 228 62 63 Tel. +32 (0)9 232 46 48 - Fax. +32 (0)9 232 46 49 - Mobil. +32 (0)475 47 37 27 Tel. & Fax. +32 (0)9 255 59 94 - Mobil. +32 (0)475 63 22 02 0049 0180 1000 877 (0,06 Euro/min.) VIP Tickets: (0049) 30-300 928-38/ Frau Ahrend ++49-(0)30-301 80 28 Tel.: (004930)-302 52 94 Fax: (004930)-302 94 40 Germany: 0900 10 11 333 (1.99 euro/min for calls from the local network) Austria flagAustria: 0900 51 03 61 121 (2.16 euro/min for calls from the local network) Switzerland flagSwitzerland: 0900 51 03 61 (4.23 CHF/min for calls from the local network) "+pvm) http://www.lippupalvelu.fi +358 (0) 600 10 800 (1,83 euro/min+lnc) or +358 (0) 600 10 020 (5,99 euros/call+lnc). June 11th, Oktyabrsky", St Petersburg ..." (+45) 33 33 22 49 (+358) 6 784 7790 051/61.23.57 Fax: 32-9-221.46.70 tel. 0032 (0)4381 07 36 - fax 0032 (0)4381 21 59 tel: (32)(0)57/444223 gsm: 0473/612922 0032-(0)3 677 19 91 T 050 288 610 F 050 37 00 21 030 - 84 59 08 - 22 German (0 34 56) 34 56 67 | (03 45) 5 67 67 | (0 45) 2 33 45-45 French 01 46 70 89 12 | 01-46-70-89-12 Dutch 06-539-439-99 | 05-75 46 30 50 other 0091(22) 31544 uk +44 (0) 1234 567890 ru +91-(020)-2344533


Title: common pattern for telephone numbers
Name: mary
Date: 2/9/2007 8:44:36 AM
Comment:
common pattern for telephone no's not working fine. plz send if any other patterns r found. its not working fine.so plz help me. Regards Mary


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