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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find UK Phone Number
Expression
^(((\+44\s?|0044\s?)?|(\(?0))((2[03489]\)?\s?\d{4}\s?\d{4})|(1[23456789]1\)?\s?\d{3}\s?\d{4})|(1[23456789][234578][0234679]\)?\s?\d{6})|(1[2579][0245][0467]\)?\s?\d{5})|(11[345678]\)?\s?\d{3}\s?\d{4})|(1[35679][234689]\s?[46789][234567]\)?\s?\d{4,5})|([389]\d{2}\s?\d{3}\s?\d{4})|([57][0-9]\s?\d{4}\s?\d{4})|(500\s?\d{6})|(7[456789]\d{2}\s?\d{6})))$
Description
UK phone number for both Geographic (landline) and Non-Geographic (Cell) numbering. It validates a complete range of combination of area code, location and formate , it also allows international number starting from +44 or 0044 and it also allows () with area code and spaces.
Matches
+44 20 xxxx xxxx | 0044 20 xxxx xxxx | 020 xxxx xxxx | (020) xxxx xxxx | (020)xxxxxxx |020 xxxx xxxxx | (01xxx) xxxxxx | (01xxx) xxxxx | (01x1) xxx xxxx | (011x) xxx xxxx | (02x) xxxx xxxx | (01xxxx) xxxxx and (01xxxx) xxxx | 05x xxxx xxxx | 03xx xxx xxxx | 07xxx xxxxxx | 08xx xxx xxxx and 09xx xxx xxxx
Non-Matches
+44 020 xxxx xxxx | +44 (20) xxxx xxxx
Author Rating: The rating for this expression. Masood Ahmed Panezai
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

Title: Good effort. There's a few small optimisations that might help.
Name: g1smd
Date: 8/4/2012 7:40:44 PM
Comment:
The ^(((\+44\s?|0044\s?)?|(\(?0)) pattern simplifies to ^((((00\s?|\+)44\s?)|\(?0)) here. I think ([57][0-9]\s?\d{4}\s?\d{4}) should be ((5[56]|70)\s?\d{4}\s?\d{4}) here. The (500\s?\d{6}) pattern should probably be |([58]00\s?\d{6}) here. The 7[456789]\d{2}\s?\d{6} pattern should probably be 7([45789]\d{2}|624)\)?\s?\d{3}\s?\d{3} here. A few prefixes that should be valid don't match. Are you using the latest area code lists?


Title: Doesn't match numbers in Workington
Name: Alastair
Date: 1/12/2012 9:02:58 AM
Comment:
Workington numbers are 01900 xxxxxx and these seem to fail this test


Title: How about 0800 numbers with nine digits?
Name: Steve
Date: 9/27/2011 6:36:51 AM
Comment:
Fails to match 0800 XXXXXX which is a valid number format (as well as not matching 0800 1111 and 0845 4647, though the latter two are not that important). Does it match 0500 XXXXXX too? Those are a digit shorter than most other UK numbers.


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