note 50864 added to function.preg-match

From: Date: Fri, 11 Mar 2005 21:15:39 +0000
Subject: note 50864 added to function.preg-match
Groups: php.notes 
Request: Send a blank email to php-notes+get-86296@lists.php.net to get a copy of this message
This is a modified version of the valid_ipv4 function that will test for a valid ip address with wild cards. ie 192.168.0.* or even 192.168.*.1 function valid_ipv4($ip_addr) { $num="(\*|[0-9]{1,3}|^1?\d\d$|2[0-4]\d|25[0-5])"; if(preg_match("/$num\.$num\.$num\.$num/",$ip_addr,$matches)) { print_r ($matches); return $matches[0]; } else { return false; } } ---- Manual Page -- http://www.php.net/manual/en/function.preg-match.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50864 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50864&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50864&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50864&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50864&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50864&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50864&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86296) next »