note 31618 added to function.ereg
| From: | mel at rack1 dot php dot net | Date: | Mon, 28 Apr 2003 09:51:38 +0000 |
| Subject: | note 31618 added to function.ereg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-47199@lists.php.net to get a copy of this message | ||
To match an IPv4 address, the following should work (untested):
'^
([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])\.
([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])\.
([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])\.
([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])
$'
Without the line breaks, obv.
Each segment should match any number less than 256 (including zero) with 1-3 digits, including
leading zeroes.
--
http://www.php.net/manual/en/function.ereg.php
http://master.php.net/manage/user-notes.php?action=edit+31618
http://master.php.net/manage/user-notes.php?action=delete+31618
http://master.php.net/manage/user-notes.php?action=reject+31618