note 37843 added to function.preg-match

From: Date: Sat, 29 Nov 2003 13:37:43 +0000
Subject: note 37843 added to function.preg-match
Groups: php.notes 
Request: Send a blank email to php-notes+get-61136@lists.php.net to get a copy of this message
Just a simple correction to mkr@binarywerks post, using this: <?php $num="([0-9]|1?\d\d|2[0-4]\d|25[0-5])"; ?> would not match any two digit number, matches, 0-9 or 100-199 or 200-249 250-255 Leaving out 10-99, easily corrected with this: <?php $num="([0-9]{1,2}|1?\d\d|2[0-4]\d|25[0-5])"; ?> Adding the 1,2 means it can be 1 or 2 digits in lenght. -- Andy Calderbank ---- Manual Page -- http://www.php.net/manual/en/function.preg-match.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37843 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37843&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37843&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#61136) next »