Return to Snippet

Revision: 7005
at July 1, 2008 09:37 by aristoworks


Initial Code
$string = "255.255.255.255";
if (preg_match(
'/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/',
$string)) { 
echo "IP address is good.";
}

Initial URL
http://www.thejwalker.com

Initial Description
A simple method of validating an IP address using PHP and regular expressions

Initial Title
PHP (RegEx) IP Address Validation

Initial Tags
php, validation, ip

Initial Language
PHP