You've probably seen this before, if not a thousand times, but here's a simple function to check the format of a UK postcode.
PHP:
-
function valid_uk_postcode($postcode)
-
{
-
return (preg_match('/^([A-PR-UWYZ][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {0,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$/i', $postcode)) ?
-
true : false;
-
}




0 Responses to “Validate a UK postcode”
Leave a Reply
You must login to post a comment.