$re = '/dst\=((?:10\.)|(?:172\.1[6-9]\.)|(?:172\.2[0-9]\.)|(?:172\.3[0-1]\.)|(?:192\.168\.)).+/m';
$str = 'dst=192.168.1.2
dst=10.10.10.10
dst=101.20.10.7
dst=11.10.10.10
dst=100.26.23.45
dst=123.123.123.123
dst=172.16.24.36
dst=98.23.45.12
dst=10.20.30.40
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php