RE: [PHP] EREGI -- Help
| From: | Johnson, Kirk | Date: | Wed, 16 May 2001 17:48:54 +0000 |
| Subject: | RE: [PHP] EREGI -- Help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-53081@lists.php.net to get a copy of this message | ||
Give this a try:
if(!ereg("^([0-9]{5}([-]{1}[0-9]{4})?)$",$data)) {
Kirk
> -----Original Message-----
> From: Jason Caldwell [mailto:jason@thinkingman.org]
> Sent: Tuesday, May 15, 2001 8:16 PM
> To: php-general@lists.php.net
> Subject: [PHP] EREGI -- Help
>
>
> I'm just trying to create a eregi expression that will evaluate a zip
> code... and I cannot get it to work... can anyone assist me
> with this? --
> also, is there a site that shows regular expression examples
> for checking
> fields like, zip codes, phone numbers, etc...
>
> if(!(eregi("(^[0-9]{5})(\\-([0-9]{4}$))?", $data)))
> $err[] = $desc . " - Invalid Zip Code " . $req;
>
> Thanks
> Jason