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:
Santosh Potadar
|
Source |
|
Your Rating |
|
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.