// get host name from URL preg_match("/^(http:\/\/)?([^\/]+)/i", "http://chezmoi.aol.ca/beitaqu/now322836.html", $matches); $host = $matches[2]; // get last two segments of host name preg_match("/[^\.\/]+\.[^\.\/]+$/", $host, $matches); echo "domain name is: {$matches[0]}\n"; //The above works fine. It appears the when I give preg_match a direct source for the pattern to match it works, but giving it an //array doesn't work as show below: // get host name from URL preg_match("/^(http:\/\/)?([^\/]+)/i", $linkarray[1][$i], $matches); $host = $matches[2]; // get last two segments of host name preg_match("/[^\.\/]+\.[^\.\/]+$/", $host, $matches); echo "domain name is: {$matches[0]}\n"; //This doesn't give a result.