note 30025 deleted from function.preg-match by sniper
| From: | sniper@php.net | Date: | Tue, 30 Sep 2003 12:15:57 +0000 |
| Subject: | note 30025 deleted from function.preg-match by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57402@lists.php.net to get a copy of this message | ||
Note Submitter: konik
----
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-9][\d])|((1[\d]{2})|(2[0-4]
[\d])|(25[0-4])))(\.(([\d])|([1-9][\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