It’s often hard to find good UK-aware regular expressions (for use with the ASP.NET RegularExpressionValidator or the .NET RegEx class). I was therefore delighted to come across RegExLib.com, which contains a most comprehensive listing of commonly used regular expressions. I wish more US sites would take this into account too – not everyone has a telephone number of the form (xxx) xxx-xxxx!
Some of the most useful ones:
One big gap is for UK telephone numbers – as with other European countries such as Germany, the number format can vary depending on the area code. There are several expressions listed at RegExLib, but none of them properly match the Ofcom recommended presentation style. Has anyone found a better regular expression that they’d like to share?