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

Please support RegExLib Sponsors

Sponsors

Advanced Search

Keywords

Category

Minimum Rating

Results per Page

Search Results: 15 regular expressions found.

   Displaying page 1 of 1 pages; Items 1 to 15
Title Test Details Pattern Title
Expression
(\s*\(?0\d{4}\)?(\s*|-)\d{3}(\s*|-)\d{3}\s*)|(\s*\(?0\d{3}\)?(\s*|-)\d{3}(\s*|-)\d{4}\s*)|(\s*(7|8)(\d{7}|\d{3}(\-|\s{1})\d{4})\s*)
Description
another uk telephone number regex. This was adapted from another on this site http://www.regexlib.com/REDetails.aspx?regexp_id=297 I added support for hyphens and for london shorthand numbers ie. 8234-1234 72341234 Still want to be permissive where possible....Still need to sort out the all zeros, also not sure if numbers with 4 digits followed by 7 used in london 0208-234-1234 is the area of the uk where this occurs, or all areas outside of london are in format 5 digits followed by 6 digits ie. 01608 123456. If that is the case for the 4-7 pattern only 0208 or 0207 could be enforced.
Matches
0208 993 5689 | 0208-993-5689 | 89935689
Non-Matches
1608 123 456
Author Rating: The rating for this expression. Matt Baskey
Title Test Details Pattern Title
Expression
(\s*\(?0\d{4}\)?(\s*|-)\d{3}(\s*|-)\d{3}\s*)|(\s*\(?0\d{3}\)?(\s*|-)\d{3}(\s*|-)\d{4}\s*)|(\s*(7|8)(\d{7}|\d{3}(\-|\s{1})\d{4})\s*)
Description
another uk telephone number regex. This was adapted from another on this site http://www.regexlib.com/REDetails.aspx?regexp_id=297 I added support for hyphens and for london shorthand numbers ie. 8234-1234 72341234 Still want to be permissive where possible....Still need to sort out the all zeros, also not sure if numbers with 4 digits followed by 7 used in london 0208-234-1234 is the area of the uk where this occurs, or all areas outside of london are in format 5 digits followed by 6 digits ie. 01608 123456. If that is the case for the 4-7 pattern only 0208 or 0207 could be enforced.
Matches
0208 993 5689 | 0208-993-5689 | 89935689
Non-Matches
1608 123 456
Author Rating: Not yet rated. Matt Baskey
Title Test Details Pattern Title
Expression
(^0[1-9]\d{1}\s\d{4}\s?\d{4}$)|(^0[1-9]\d{2}\s\d{3}\s?\d{4}$)|(^0[1-9]\d{2}\s\d{4}\s?\d{3}$)|(^0[1-9]\d{3}\s\d{3}\s?\d{2}$)|(^0[1-9]\d{3}\s\d{3}\s?\d{3}$)|(^0[1-9]\d{4}\s\d{3}\s?\d{2}$)|(^0[1-9]\d{4}\s\d{2}\s?\d{3}$)|(^0[1-9]\d{4}\s\d{2}\s?\d{2}$)
Description
This will match valid UK telephone numbers. This adheres to ofcom's code and number length guide available at http://www.ofcom.org.uk/licensing_numbering/numbers/num_user_guide#1b Brackets and international codes are not allowed. A space MUST be used after the dialling code, and spaces at the expected points within the remainder of the number can be used if need be, but not nessesary, hence 0208 6473 373 is the same as 0208 647 3373 and 0208 6473373
Matches
01323 293 374 | 020 73643763 | 017354 7478
Non-Matches
02 83838 74 | (01323) 828223 | +44 88282 828
Author Rating: The rating for this expression. rob collyer
Title Test Details Pattern Title
Expression
(02\d\s?\d{4}\s?\d{4})|(01\d{2}\s?\d{3}\s?\d{4})|(01\d{3}\s?\d{5,6})|(01\d{4}\s?\d{4,5})
Description
Validates UK domestic landline phone numbers. Valid formats are: 029 99999999 or 029 9999 9999; 0199 9999999 or 0199 999 9999; 01999 99999; 01999 999999; 019999 9999; 019999 99999. These formats are taken from the official guidelines from Ofcom, the organisation responsible for UK telecoms issues. Brackets are not valid and STD code must be entered.
Matches
020 1234 5678 | 0123 4567890 | 01234 456789
Non-Matches
02476 123456 | 0845 123456 | 07712 345678
Author Rating: The rating for this expression. John Chivers
Title Test Details Pattern Title
Expression
(077|078|079)\s?\d{2}\s?\d{6}
Description
Validates UK mobile phone numbers. Valid formats are `077', `078' or `079' followed by another 8 digits, with an optional space after the dialling code and/or between the 4th and 5th characters of the remainder of the number. These formats are taken from the official guidelines from Ofcom, the organisation responsible for UK telecoms issues. Brackets are not valid and STD code must be entered.
Matches
07713 345678 | 078 12345678 | 079 12345678
Non-Matches
02344 123456 | 0121 292929 | 012345 6789
Author Rating: Not yet rated. John Chivers
Title Test Details UK Telephone
Expression
(((\+44)? ?(\(0\))? ?)|(0))( ?[0-9]{3,4}){3}
Description
This regex matches UK phone numbers in multiple formats, including those that begin with the international dial code and optionally bracket the leading zero of the area code. To match a number must begin with either +44 or 0 and have 9-12 following digits.
Matches
+44 (0) 1234 567890 or +44 1234 567890 or 01234 567890 or 0123 456 7890
Non-Matches
Numbers not beginning with 0 or +44 and numbers with less than 9 digits
Author Rating: The rating for this expression. VB
Title Test Details UK telephone number match
Expression
(\(?\+44\)?\s?(1|2|3|7|8)\d{3}|\(?(01|02|03|07|08)\d{3}\)?)\s?\d{3}\s?\d{3}|(\(?\+44\)?\s?(1|2|3|5|7|8)\d{2}|\(?(01|02|03|05|07|08)\d{2}\)?)\s?\d{3}\s?\d{4}|(\(?\+44\)?\s?(5|9)\d{2}|\(?(05|09)\d{2}\)?)\s?\d{3}\s?\d{3}
Description
Matches most common patterns for UK telephone numbers including +44 prefix , and with or without brackets. Covers 10 and 11 digit number ranges. Should be easy to modify for other number ranges.
Matches
01234 123 123 , (+44)1234 123 123 , 0123 456 7890 , 01234567890 , (01234) 567 890
Non-Matches
1234 123 123 , +44 01234 567 890
Author Rating: The rating for this expression. Ian Smith
Title Test Details UK Telephone Numbers
Expression
((\+44\s?\(0\)\s?\d{2,4})|(\+44\s?(01|02|03|07|08)\d{2,3})|(\+44\s?(1|2|3|7|8)\d{2,3})|(\(\+44\)\s?\d{3,4})|(\(\d{5}\))|((01|02|03|07|08)\d{2,3})|(\d{5}))(\s|-|.)(((\d{3,4})(\s|-)(\d{3,4}))|((\d{6,7})))
Description
Matches over 18 different combinations for UK phone numbers that I could find. If there are any errors please get in touch.
Matches
0121 111 1111|+44 (0)21 444 4444|07941 111 111|07941 111111|(+44) 121 222 3333
Non-Matches
0121_111_3333
Author Rating: The rating for this expression. Darren Moore
Title Test Details UK Phone Number
Expression
^((\+44\s?\d{4}|\(?\d{5}\)?)\s?\d{6})|((\+44\s?|0)7\d{3}\s?\d{6})$
Description
Allows both mobile and landline UK Telephone Numbers. Allows either Brackets or international prefix. Allows spaces after international prefix and regional code. No brackets for mobile numbers. Please report any problems. Thanks
Matches
01902123456 | 01902 123456 | (01902)123456 | (01902) 123456 | +441902123456 | +441902 123456 | +44 1902123456 | +44 1902 123456 | 07807123456 | 07807 123456 | +447807123456 | +447807 123456 | +44 7807123456 | +44 7807 123456
Non-Matches
11902123456 | (+441902)123456 | 441902123456 | (078)07123456
Author Rating: Not yet rated. Jay Anslow
Title Test Details Match UK telephone number in any format.
Expression
^\(?(?:(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?\(?(?:0\)?[\s-]?\(?)?|0)(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}|\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4}|\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3})|\d{5}\)?[\s-]?\d{4,5}|8(?:00[\s-]?11[\s-]?11|45[\s-]?46[\s-]?4\d))(?:(?:[\s-]?(?:x|ext\.?\s?|\#)\d+)?)$
Description
Step 1: Test that the input is a UK phone number. Later patterns extract the prefix, NSN and extension, and further tests check the NSN for length and validity. The above pattern matches optional opening parentheses, followed by 00 or 011 and optional closing parentheses, followed by an optional space or hyphen, followed by optional opening parentheses. Alternatively, the opening parentheses are followed by a literal + without a following space or hyphen. Any of the previous options are then followed by 44 with optional closing parentheses, followed by optional space or hyphen, followed by optional 0 in optional parentheses, followed by optional space or hyphen, followed by optional opening parentheses (international format). Alternatively, the pattern matches optional opening parentheses followed by the 0 trunk code (national format). This is followed by the area code and phone number in 2+8, 3+7, 3+6, 4+6, 4+5, 5+5 or 5+4 format with or without spaces and/or hyphens. This also includes provision for optional closing parentheses and/or optional space or hyphen after where the user thinks the area code ends and the local number begins. The pattern allows any format to be used with any UK number. The display format must be corrected by later logic if the wrong format for this number has been used by the user on input. The pattern finally ends with optional space or hyphen followed by x, ext and optional period, or #, followed by a three or four digit extension number. Once the input has been confirmed as being a telephone number using the above pattern, another RegEx pattern should extract prefix, NSN and extension and then the NSN should be further tested for length and validity. (Order fixed for even greater efficiency: shorter area codes match first.)
Matches
020 3000 5555, (020) 3000 5555, +44 20 3000 5555, 00 44 20 3000 5555, 011 44 20 3000 5555, 0203 000 5555, 02030 005 555, (+44) 20 3000 5555, (+44 20) 3000 5555, and many others, any with NSN of 10 or 9.
Non-Matches
01750 5555, 0203 5555 7777, +33 1 2345 6789
Author Rating: The rating for this expression. g1smd
Title Test Details Extract NSN, prefix and extension from UK telephone number.
Expression
^\(?(?:(?:0(?:0|11)\)?[\s-]?\(?|\+)(44)\)?[\s-]?\(?(?:0\)?[\s-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d-]+)(?:((?:x|ext\.?\s?|\#)\d+)?)$
Description
Step 2: After step 1 has verified the input is likely to be a UK telephone number, this pattern extracts the NSN part of the number so that it can be passed to another routine that will check it for length and validity. $1 is 44 (international format) or null (use 0 for trunk code - national format). $2 is the NSN. $3 is the extension number.
Matches
020 3000 5555, (020) 3000 5555, +44 20 3000 5555, 00 44 20 3000 5555, 011 44 20 3000 5555, 0203 000 5555, 02030 005 555, (+44) 20 3000 5555, (+44 20) 3000 5555, and many others, any with NSN of 10 or 9.
Non-Matches
01750 5555, 0203 5555 7777, +33 1 2345 6789
Author Rating: The rating for this expression. g1smd
Title Test Details Validate UK telephone number NSN by initial digits and length (simple version).
Expression
^((1[1-9]|2[03489]|3[0347]|5[56]|7[04-9]|8[047]|9[018])\d{8}|(1[2-9]\d|[58]00)\d{6}|8(001111|45464\d))$
Description
Step 3: Validate the NSN produced from the pattern in step 2 and check it for length and validity. The pattern here is fairly basic. More detailed patterns for each number type are available elsewhere. Step 4 is to format the number correctly. This needs a variety of RegEx patterns each based on the initial digits and number length.
Matches
20 3000 5555, 121 555 7777, 1750 618888, 1750 62555, 19467 55555, 16977 3555, 303 555 7788, 500 777999, 55 4455 7788, 70 7788 5577, 800 555777, 800 444 7799, 845 333 5577, 871 444 5577, 909 555 7788 after removing spaces
Non-Matches
20 444 666, 20 555 7777, 1999 5577, 1999 555 7799, 22 5000 7777, 800 55555, 803 555777, 815 555 7777, 845 8888 9999
Author Rating: The rating for this expression. g1smd
Title Test Details Validate UK telephone number NSN by initial digits and length (detailed version).
Expression
^(2(?:0[01378]|3[0189]|4[017]|8[0-46-9]|9[012])\d{7}|1(?:(?:1(?:3[0-48]|[46][0-4]|5[012789]|7[0-49]|8[01349])|21[0-7]|31[0-8]|[459]1\d|61[0-46-9]))\d{6}|1(?:2(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-4789]|7[013-9]|9\d)|3(?:0\d|[25][02-9]|3[02-579]|[468][0-46-9]|7[1235679]|9[24578])|4(?:0[03-9]|2[02-5789]|[37]\d|4[02-69]|5[0-8]|[69][0-79]|8[0-5789])|5(?:0[1235-9]|2[024-9]|3[0145689]|4[02-9]|5[03-9]|6\d|7[0-35-9]|8[0-468]|9[0-5789])|6(?:0[034689]|2[0-689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0124578])|7(?:0[0246-9]|2\d|3[023678]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-5789]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\d|8[02-9]|9[02569])|9(?:0[02-589]|2[02-689]|3[1-5789]|4[2-9]|5[0-579]|6[234789]|7[0124578]|8\d|9[2-57]))\d{6}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-4789]|8[345])))|3(?:638[2-5]|647[23]|8(?:47[04-9]|64[015789]))|4(?:044[1-7]|20(?:2[23]|8\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[123]))|5(?:24(?:3[2-79]|6\d)|276\d|6(?:26[06-9]|686))|6(?:06(?:4\d|7[4-79])|295[567]|35[34]\d|47(?:24|61)|59(?:5[08]|6[67]|74)|955[0-4])|7(?:26(?:6[13-9]|7[0-7])|442\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\d|37(?:5[2-5]|8[239])|84(?:3[2-58]))|9(?:0(?:0(?:6[1-8]|85)|52\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\d{3}|176888[234678]\d{2}|16977[23]\d{3})|7(?:[1-4]\d\d|5(?:0[0-8]|[13-9]\d|2[0-35-9])|624|7(?:0[1-9]|[1-7]\d|8[02-9]|9[0-689])|8(?:[014-9]\d|[23][0-8])|9(?:[04-9]\d|1[02-9]|2[0-35-9]|3[0-689]))\d{6}|76(?:0[012]|2[356]|4[0134]|5[49]|6[0-369]|77|81|9[39])\d{6}|80(?:0(?:1111|\d{6,7})|8\d{7})|500\d{6}|87[123]|9(?:[01]\d|8[0-3]))\d{7}|8(?:4(?:5464\d|[2-5]\d{7})|70\d{7})|70\d{8}|56\d{8}|3[0347]|55)\d{8}$
Description
Step 3: Validate the NSN produced from the pattern in step 2 and check it for length and validity. The pattern here is very detailed matching every valid UK prefix, and rejecting large numbers of non-valid ranges. Step 4 will be to format the number correctly. This needs a variety of RegEx patterns each based on the initial digits and number length as shown in the article mentioned below.
Matches
20 3000 5555, 121 555 7777, 1750 618888, 1750 62555, 19467 55555, 16977 3555, 303 555 7788, 500 777999, 55 4455 7788, 70 7788 5577, 800 555777, 800 444 7799, 845 333 5577, 871 444 5577, 909 555 7788 after removing spaces
Non-Matches
20 444 666, 20 555 7777, 1750 61555, 1999 55777, 1999 555777, 22 5000 7777, 800 55555, 803 555777, 805 555 7777, 845 8888 9999
Author Rating: The rating for this expression. g1smd
Title Test Details UK Telephone Format
Expression
^0(((1[0-9]{2}[ -]?[0-9]{3}[ -]?[0-9]{4})|(1[0-9]{3}[ -]?[0-9]{6})|(1[0-9]{4}[ -]?[0-9]{4,5}))|((1[0-9]1)|(11[0-9]))[ -]?[0-9]{3}[ -]?[0-9]{4}|(2[0-9][ -]?[0-9]{4}[ -]?[0-9]{4})|((20[ -]?[0-9]{4})|(23[ -]?[8,9][0-9]{3})|(24[ -]?7[0-9]{3})|(28[ -]?(25|28|37|71|82|90|92|95)[0-9]{2})|(29[ -]?2[0-9]))[ -]?[0-9]{4}|(7[4-9][0-9]{2}[ -]?[0-9]{6})|((3[0,3,4,7][0-9])[ -]?[0-9]{3}[ -]?[0-9]{4})|((5[5,6][ -]?[0-9]{4}[ -]?[0-9]{4})|(500[ -]?[0-9]{3}[ -]?[0-9]{4}))|(8[0247][0-9]{1}[ -]?[0-9]{3}[ -]?[0-9]{4})|(9[0-9]{2}[ -]?[0-9]{3}[ -]?[0-9]{4}))$
Description
Follows http://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom must have a specific length and be a valid telephone number in the UK Must start with a 0, have included 01 02 03 05 08 numbers. character spacing have be " ", "-", accepts 01 02 03 05 07 08 numbers, rejects everything else.
Matches
020 1234 1234 | 020-1234-1234 | 02012341234 | 01234 123456 | 012345 1234
Non-Matches
0201 234 1234 | 0201-234-1234 | 0201234123 | 012341 23456 | 0123451 234 | 00000 000000
Author Rating: Not yet rated. Craig Hughes
Title Test Details UK Telephone Numbers
Expression
^(((\+|00)?44|0)([123578]{1}))(((\d{1}\s?\d{4}|\d{2}\s?\d{3})\s?\d{4})|(\d{3}\s?\d{2,3}\s?\d{3})|(\d{4}\s?\d{4,5}))$
Description
Validates UK phone numbers based on the Wikipedia page http://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom including the international dialing code 0044/+44/44
Matches
0XX XXXX XXXX | 0XXX XXX XXXX | 0XXXX XXXXXX
Non-Matches
04XXX XXXXXX | 06XXX XXXXXX | 0XXXXXXX
Author Rating: The rating for this expression. Paul Verhulpen
   Displaying page 1 of 1 pages; Items 1 to 15

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