note 24406 deleted from function.ereg by didou

From: Date: Sun, 07 Dec 2003 02:59:01 +0000
Subject: note 24406 deleted from function.ereg by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-61555@lists.php.net to get a copy of this message
Note Submitter: benstinton@hotmail.com ---- For the UK Postcode parses the script should read as below. i.e. without the question marks. The reason being that a format such as "A1 2BC" is used for some London postcodes. Without the space the code would assume that the Area code was A12 rather than A1. Hope that makes sense. I think I'm right on this one. function valid_postcode ($str) { return (ereg ('^[A-Z]{1,2}[0-9]{1,2}[A-Z]{0,1} [0-9][A-Z]{2}$', $str)); }

« previous php.notes (#61555) next »