I have this code right here:
// get host name from URL preg_match(\'@^(?:http://)?([^/]+)@i\', \"http://www.joomla.subdomain.php.net/index.html\"
Group the first part of your 2nd regex into /([^.]+)\.[^.]+$/ and $matches[1] will be php
/([^.]+)\.[^.]+$/
$matches[1]