note 63099 deleted from function.ereg by tularis
| From: | tularis@php.net | Date: | Thu, 31 May 2007 13:22:06 +0000 |
| Subject: | note 63099 deleted from function.ereg by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127060@lists.php.net to get a copy of this message | ||
Note Submitter: Tristan Scott - trs998 at gmail dot com
----
ereg("^[a-zA-Z]{1,2}((\d{1,2})|(\d{1}[a-zA-Z]{1}))[ ]?\d{1}[a-zA-Z]{2}$")
Should check for valid postcodes in the uk.
Note: this will not match GIR 0AA, whcih is in use but doesn't follow the post office rules.
also, this is not strict... some invalid postcodes are permitted some letters do not appear in some
positions. It will, however, match:
AN NAA
ANN NAA
AAN NAA
AANN NAA
ANA NAA
AANA NAA