$re = '/^((?!mysite|google).)*$/m';
$str = 'https://www.google.co.uk/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=wordpress+redirect+get+referrer
mysite.co.uk
http://mysite.co.uk
mysite.ie
http://mysite-wp.sandbox/wp-admin/tools.php?page=redirection.php
http://superuser.com/questions/231540/how-can-i-see-a-pages-referrer-in-chrome
https://regex101.com/#pcre';
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