Posted By

Scooter on 08/23/08


Tagged


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

DaveChild
dmitryfstyleca
jeremyhcobb
jadb
tiffle


Validate UK PostCode


 / 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.

  1. ^([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))$

Report this snippet  

You need to login to post a comment.