note 55684 deleted from function.ereg by tularis
| From: | tularis@php.net | Date: | Thu, 31 May 2007 13:24:11 +0000 |
| Subject: | note 55684 deleted from function.ereg by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127070@lists.php.net to get a copy of this message | ||
Note Submitter: fox
----
concerning the 'valid postal code' bit from 25 july -
regular expressions are good for turning the longer zip checking code given below into much shorter
snippets, such as the following (which accomplishes the same zip code check):
$error_code=(ereg("^[0-9]{5}(-[0-9]{4})$",$zip))? NULL:1;
the expression requires the first five digits and allows an additional four; the hyphen is required
if the optional four are present