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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^[A-Za-z]{1,2}[0-9A-Za-z]{1,2}[ ]?[0-9]{0,1}[A-Za-z]{2}$
Description
This regular expression can be used to validate UK postcodes. Especially useful if want to provide a client side validation on a web site.
Matches
SW112LE | SW11 2LE | CR05LE
Non-Matches
12CR0LE | 12CR 0LE | SWLE05
Author Rating: The rating for this expression. Santosh Potadar
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: Great
Name: Crusader
Date: 6/30/2006 4:25:21 AM
Comment:
great regex, not too restrictive. I mean you don't want to throw every invalid submission away, otherwise you could be losing enquiries. Thanks for the Regex....


Title: Not very good
Name: Howard
Date: 4/16/2005 6:43:28 AM
Comment:
This is very weak: it only picked up obvious problems. Of my 1423 invalid postcodes, it incorrectly matched 635 as valid.


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