All pastes #896655 Raw Edit

dw

public text v1 · immutable
·published 2008-02-08 21:20 UTC
rendered paste body
<?
$string = "slcmdlmcdlcmdlcmdlmdlmd10.1.0.2cldmlcdmcldmcldmc()";
$regex = "(\d{1,3}\.){2}\d{1,3}";
$search = preg_match("$regex", $string, $matches);
if ($search) {
        $ip = $matches[0];
        $test = long2ip(ip2long($ip));
        if ($test != "0.0.0.0") {
                echo "$test\n";
        } else {
                echo "That aint no IP sucka!";
        }
}
?>