Title |
Test
Find
UK Phone # with International option
|
Expression |
^\s*\(?((\+0?44)?\)?[ \-]?(\(0\))|0)((20[7,8]{1}\)?[ \-]?[1-9]{1}[0-9]{2}[ \-]?[0-9]{4})|([1-8]{1}[0-9]{3}\)?[ \-]?[1-9]{1}[0-9]{2}[ \-]?[0-9]{3}))\s*$ |
Description |
UK phone number formats with optional international prefix, optional spaces, dashes and brackets. Brackets mandatory for regional/capital leading zero if included in international form. Based on "Mh" UK London & Regional. (Thanks Mh for the groundwork). New to Regex so I'm sure it can be done more elegantly... but it works. |
Matches |
0208-123-4567 | 01234-567890 | (01234) 567890 | +44 (0)1234 567890 | +044(0)1234567890 |
Non-Matches |
208-123-4567 | 012345-67890 | (1234) 567890 | 44 (0)1234 567890 | +034(0)1234567890 |
Author |
Rating:
Andrew McCormick
|
Source |
|
Your Rating |
|
Title: Include +447437592644 pattern
Name: kate
Date: 3/5/2020 2:38:06 PM
Comment:
^\s*\(?((\+0?44)?\)?[ \-]?(\(0\))?|0)?((20[7,8]{1}\)?[ \-]?[1-9]{1}[0-9]{2}[ \-]?[0-9]{4})|([1-8]{1}[0-9]{3}\)?[ \-]?[1-9]{1}[0-9]{2}[ \-]?[0-9]{3}))\s*$
Title: Doesn't match valid numbers in Cumbria.
Name: Steve
Date: 9/27/2011 6:28:29 AM
Comment:
Fails to match (019467) 23456 and (016977) 3355 both of which are valid in and around Cumbria.
Additionally, all 02 numbers are formatted (02X) XXXX XXXX, and not as shown above.
Title: Doesn't cope with 5 digit numbers
Name: LauraNash
Date: 1/23/2009 10:26:51 AM
Comment:
This doesn't cope with 5 digit UK telephone numbers (like the ones we have here in rural Somerset) i.e. (01460) xxxxx
Title: 0208 is not a phone code.
Name: IainMH
Date: 10/7/2008 5:02:05 AM
Comment:
020 is the dialling code for London.