Home  |  Linux  | Mysql  | PHP  | XML
From:Marc@osu1.php.net Date:Mon Oct  6 02:16:27 2008
Subject:note 86150 added to function.preg-match
@ 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 ;)
----
Server IP: 212.124.37.9
Probable Submitter: 84.58.176.33
----
Manual Page -- http://www.php.net/manual/en/function.preg-match.php
Edit        -- https://master.php.net/note/edit/86150
Del: integrated  -- https://master.php.net/note/delete/86150/integrated
Del: useless     -- https://master.php.net/note/delete/86150/useless
Del: bad code    -- https://master.php.net/note/delete/86150/bad+code
Del: spam        -- https://master.php.net/note/delete/86150/spam
Del: non-english -- https://master.php.net/note/delete/86150/non-english
Del: in docs     -- https://master.php.net/note/delete/86150/in+docs
Del: other reasons-- https://master.php.net/note/delete/86150
Reject      -- https://master.php.net/note/reject/86150
Search      -- https://master.php.net/manage/user-notes.php

Navigate in group php.notes at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by Zareef Ahmed
Powered By PHP Consultants