$re = '/^(?!.*\bdetails\.cfm\b).*\bselector=size\b.*$/m';
$str = 'http://www.anydotcom.com/test/search.cfm?metric=blah&abcselector=size&value=1
http://www.anydotcom.com/test/search.cfm?metric=blah2&selector=style&value=1
http://www.anydotcom.com/test/search.cfm?metric=blah3&selector=sizeabc&value=1
http://www.anydotcom.com/test/details.cfm?metric=blah&selector=size&value=1
http://www.anydotcom.com/test/search.cfm?metric=blah3&selector=size&value=1
http://www.anydotcom.com/test/search.cfm?metric=blah&selector=size&value=1
http://www.anydotcom.com/test/search.cfm?metric=blah3&value=1&selector=size
http://www.anydotcom.com/test/search.cfm?metric=blah&value=1&selector=size
http://www.anydotcom.com/test/details.cfmabc?metric=blah&selector=size&value=1
http://www.anydotcom.com/test/abcdetails.cfm?metric=blah&selector=size&value=1';
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