Title |
Test
Find
Pattern Title
|
Expression |
^[A-Za-z]{1,2}[\d]{1,2}([A-Za-z])?\s?[\d][A-Za-z]{2}$ |
Description |
UK Postal Codes - The code is normally written in capital letters with a space between the outer and inner parts; it is understandable if the space is omitted.
This regular expression validates upper or lower case with or without the space:
|
Matches |
CF1 2AA | cf564fg |
Non-Matches |
a1234d | A12 77Y |
Author |
Rating:
Not yet rated.
Scott Pite
|
Source |
Created by John Dyke |
Your Rating |
|
Title: Postcode format
Name: Grahame
Date: 11/12/2005 7:45:01 AM
Comment:
UK postal code have excluded char's in given positions;
for example: -
FORMAT EXAMPLE
AN NAA M1 1AA
ANN NAA M60 1NW
AAN NAA CR2 6XH
AANN NAA DN55 1PT
ANA NAA W1A 1HQ
AANA NAA EC1A 1BB
Please note the following:-
The letters Q, V and X are not used in the first position
The letters I,J and Z are not used in the second position.
The only letters to appear in the third position are A, B, C, D, E, F, G, H, J, K, S, T, U and W.
The second half of the postcode is always consistent numeric, alpha, alpha format and the letters C, I, K, M, O and V are never used.