note 86150 deleted from function.preg-match by danbrown
| From: | danbrown@php.net | Date: | Wed, 03 Aug 2011 13:11:58 +0000 |
| Subject: | note 86150 deleted from function.preg-match by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182153@lists.php.net to get a copy of this message | ||
Note Submitter: Marc
----
@ Steve Todorov:
Your regex will not only match 999.999... but also 9999.9999... etc.
I'd rather take this regex:
/^(1\d{0,2}|2(\d|[0-5]\d)?)\.(1\d{0,2}|2(\d|[0-5]\d)?)
\.(1\d{0,2}|2(\d|[0-5]\d)?)\.(1\d{0,2}|2(\d|[0-5]\d)?)$/
this should represent any ip (v4). At least it did in a small test here ;)