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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find UK Mobile Phone Number Check
Expression
^[0-9]{0,5}[ ]{0,1}[0-9]{0,6}$
Description
UK Mobile phone number check
Matches
01234 567890
Non-Matches
Anything that's not in the above format
Author Rating: Not yet rated. Alex Richards
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: Fixing the pattern to do the right job.
Name: g1smd
Date: 11/9/2012 11:48:21 AM
Comment:
Fixing the RegEx to not accept numbers with too few digits gives: ^\(?0\d{2}(\)?[\s-]?\d){7,8}$ instead. Modifying that RegEx to also allow +44, with optional parentheses and spaces, in place of 0 yields this: ^\(?(\+44\)?\s?\(?|0)\d{2}(\)?[\s-]?\d){7,8}$ pattern. If you want to also allow 00 44 and 011 44, with optional parentheses and spaces, then it becomes: ^\(?((0(0|11)\)?\s?\(?|\+)44\)?\s?\(?|0)\d{2}(\)?[\s-]?\d){7,8}$ instead. If you want to limit the input to numbers beginning 07 replace the \d{2} bit with 7\d here. If you want to limit the input to only mobile numbers replace the \d{2} bit with 7[4-9] or similar. UK mobile numbers do not begin 070 - those are Premium Rate "find me" numbers.


Title: Completely useless.
Name: g1smd
Date: 10/27/2012 12:31:05 PM
Comment:
As each part can have 0 length, this accepts blank input! The [ ]{0,1} simplifies to \s? here. The pattern will not match UK 2+8, 3+7, 5+5, 5+4 format numbers but will match numbers with missing digits! This pattern is way too basic to be useful. See http://regexlib.com/REDetails.aspx?regexp_id=3606 for a much improved pattern. @bob : The patterns ^[4]{2}[7]{1}\d{9}$ and ^[0]{1}[7]{1}\d{9}$ simplify to ^447\d{9}$ and ^07\d{9}$ here. You only need a character group when there's more than one character to group.


Title: hai
Name: Ram
Date: 1/2/2012 8:35:30 AM
Comment:
This is not working ...checked for 01,011,0234,0543,0987 and etc .Uk Mobile number format is 01234 567890.. but this value(01,011,0234,0543,0987) worked.


Title: hai
Name: Ram
Date: 1/2/2012 8:34:41 AM
Comment:
This is not working ...checked for 01,011,0234,0543,0987 and etc .Uk Mobile number format is 01234 567890.. but this value(01,011,0234,0543,0987) worked.


Title: The UK system is a LOT more complex than that.
Name: Steve.
Date: 11/4/2011 4:36:09 PM
Comment:
Most UK telephone numbers can have either 9 or 10 digits after the 0 trunk prefix. The initial 0 is omitted when calling from abroad. 01 and 02 area codes should have parentheses around them if the local number part does not begin with a 0 or 1. 01 and 02 area codes do not have parentheses around them if the local number part begins with a 0 or 1. These are National Dialling Only ranges. All other area codes do not have parentheses around them as the area code is required for all calls. Number formats are expressed as: 2+8 to represent (02x) xxxx xxxx [in 5 areas] or 05x xxxx xxxx or 070 xxxx xxxx or 076 xxxx xxxx. 3+7 to represent (011x) xxx xxxx [in 6 areas] or (01x1) xxx xxxx [in 6 areas] or 03xx xxx xxxx or 08xx xxx xxxx or 0800 xxx xxxx or 09xx xxx xxxx. 3+6 to represent 0500 xxxxxx or 0800 xxxxxx. 4+6 to represent (01xxx) xxxxxx [in 580 areas] or 07xxx xxxxxx. 4+5 to represent (01xxx) xxxxx [in 41 areas]. 5+5 to represent (01xx xx) xxxxx [in 12 areas]. 5+4 to represent (01xx xx) xxxx [in 1 area]. Valid formats include: (011x) - 3+7. (01x1) - 3+7. (01xxx) - 4+6 or 4+5. (01xx xx) - 5+5 or 5+4. (02x) - 2+8. 03xx - 3+7. 05x - 2+8. 0500 - 3+6. 07xxx - 4+6. 070 - 2+8. 076 - 2+8. 08xx - 3+7. 0800 - 3+7 or 3+6. 09xx - 3+7. There are a small number of exceptions such as 0800 1111 and 0845 4647. The UK system is quite complex!


Title: Hot
Name: hot-contact
Date: 11/13/2009 4:46:25 PM
Comment:
Looking for hot girls tonight? Visit hot-contact co uk.


Title: Allowing spaces, dashes & brackets etc
Name: Fraser
Date: 6/10/2009 6:23:35 AM
Comment:
^[\s\(\),-]*(((00|\+)?[\s\(\),-]*44)|0)[\s\(\),-]*7[\s\(\),-]*[5789]([\s\(\),-]*[\d]){8}$ This is based off Jasons, which I like, but the length of digits is wrong if the string has spaces. This one allows special characters while still ensuring that the correct number of digits are present


Title: A little better
Name: Jason
Date: 6/6/2008 5:26:05 AM
Comment:
Actually neither of your offerings are sufficient for a UK mobile number. The following will match any valid UK mobile number and match most popular expressions of the number: ^\+?(?:44|0|44 0)\s?7[5789][\s\d]{8}$


Title: Mr
Name: Bob
Date: 5/8/2008 7:27:40 AM
Comment:
^[4]{2}[7]{1}\d{9}$ Matches only valid UK mobile numbers that start with 447 ^[0]{1}[7]{1}\d{9}$ Matches only valid UK mobile numbers that start with 07


Title: Inaccurate Description
Name: Tim Green
Date: 2/23/2007 4:48:00 AM
Comment:
This regexp matches UK landline numbers too, so it's not specifically for UK Mobile phone numbers. UK Mobile phone numbers always require the Area Code (as it determines the network operator), and the actual number itself is always 6 digits. This regexp also fails to check that all UK Mobile phone numbers start 07. Therefore, you really should use:- ^07[0-9]{3}\s*[0-9]{6}$ This checks for the 07 prefix, followed by 3 more digits to form the 5 digit area code (not optional with UK mobile numbers), and optional space between the area code and the main number, and then a six digit main number. The original RegExp allowed for a range of 0-6 numbers as the main number. This is NOT valid for UK mobiles.


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