Published in: Regular Expression
URL: http://reusablecode.blogspot.com/2008/08/isvalidpostcode.html
Checks the validity of the format of a supplied UK postcode. Completely accurate validation is only possible by attempting to deliver mail to the address, and verifying with the recipient. Supports all six common postcode formats, Girobank, Father Christmas, British Forces Post Office, and overseas territories.
^([A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])\ [0-9][ABD-HJLNP-UW-Z]{2}|(GIR\ 0AA)|(SAN\ TA1)|(BFPO\ (C\/O\ )?[0-9]{1,4})|((ASCN|BBND|[BFS]IQQ|PCRN|STHL|TDCU|TKCA)\ 1ZZ))$
You need to login to post a comment.
