note 30025 added to function.preg-match
| From: | konik at rack1 dot php dot net | Date: | Tue, 04 Mar 2003 15:31:51 +0000 |
| Subject: | note 30025 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44830@lists.php.net to get a copy of this message | ||
just a little regexp that match correct ip address or network if
they are structured as:
xxx.yyy.yyy.yyy,
(where xxx is a number between 1 and 254 and yyy a number
between 0 and 254)
preg_match("/^(((([1-9])|([1,2][\d])|((1[\d]{2})|(2[0-4][\d])
|(25[0-4])))(\.(([\d])|([1,2][\d])|((1[\d]{2})|(2[0-4][\d])
|(25[0-4])))){3})|(0(\.0){3}))$/",$ip);
there is maybe (surely) a nicer way but this one works
--
http://www.php.net/manual/en/function.preg-match.php
http://master.php.net/manage/user-notes.php?action=edit+30025
http://master.php.net/manage/user-notes.php?action=delete+30025
http://master.php.net/manage/user-notes.php?action=reject+30025