I have this piece of code: if (preg_match('/(http(s?):\/\/)(?!((www[1-5]?|imgs)\.)?somesite\.com(?!\/pan\/)($|\/))/i', $rightlink)) { $rightlink = 'http://www.somesite.com/out.php?l=' . urlencode($rightlink); } PHP: I need the reg ex written so that the conditional is false if $rightlink contains the following domains: thatsite.com othersite.com Thanks in advance!
You can use parse_url() and compare the hostname for the parsed URL against the hostnames you want to exclude.