note 45260 added to function.preg-match

From: Date: Tue, 31 Aug 2004 14:47:55 +0000
Subject: note 45260 added to function.preg-match
Groups: php.notes 
Request: Send a blank email to php-notes+get-75745@lists.php.net to get a copy of this message
The above ZIP match is wrong, as it assumes ZIP codes don't start with 0 or 1. For example, it will fail on: 03064 nashua, nh 11234 brooklyn, ny Corrected: <? preg_match("/^[0-9]{5}([-]{1}[0-9]{4})?$/",$string)) ?> ---- Manual Page -- http://www.php.net/manual/en/function.preg-match.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45260 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45260&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45260&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#75745) next »