note 24406 added to function.ereg
| From: | benstinton at hotmail dot com | Date: | Thu, 15 Aug 2002 12:22:41 +0000 |
| Subject: | note 24406 added to function.ereg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-35066@lists.php.net to get a copy of this message | ||
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));
}
--
http://www.php.net/manual/en/function.ereg.php
http://master.php.net/manage/user-notes.php?action=edit+24406
http://master.php.net/manage/user-notes.php?action=delete+24406
http://master.php.net/manage/user-notes.php?action=reject+24406