Displaying page
of
pages;
Items to
Title |
Test
Details
UK Postcode (post code)
|
Expression |
\A(([a-zA-Z]{1,2}\d{1,2})|([a-zA-Z]{2}\d[a-zA-Z]{1}))\x20{0,1}\d[a-zA-Z]{2}\Z
|
Description |
I used this in C#.NET to check the validity of UK postcode entries. It successfully matches all acceptable formats (with or without a space) but does not check that the actual postcode is valid due to constant changes. Hope this helps - Jon
NOTE: If you are not using in .NET yoy may need to replace \d with [0-9], \A with ^, and \Z with $.
|
Matches |
S1 1AA, S11 1AA, SS1 1AA, SS11 1AA, SW1X 1AA
|
Non-Matches |
S1X 1AA
|
Author |
Rating:
Not yet rated.
Jon Bellamy
|
Displaying page
of
pages;
Items to