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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details 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: The rating for this expression. Andrew McCormick
   Displaying page 1 of 1 pages; Items 1 to 1

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