note 90619 deleted from function.ereg by danbrown
| From: | danbrown@php.net | Date: | Thu, 30 Apr 2009 17:31:28 +0000 |
| Subject: | note 90619 deleted from function.ereg by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154058@lists.php.net to get a copy of this message | ||
Note Submitter: Mo Braga
----
Use the following regular expression if you want it (1) case-insensitive and (2) the space
separating the two blocks to be optional:
$expr = '(?i)(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|';
$expr .= '([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|';
$expr .= '[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW]) ?';
$expr .= '[0-9][ABD-HJLNP-UW-Z]{2})'
Example of valid postcodes: W2 9JP, w2 9jp, w29jp.