$host_names = array('www', 'ftp', 'bonsai', 'bugzilla', 'jt', 'lxr', 'moz', 'mozilla', 'tinderbox');
 
$host_names_re = '(' . implode($host_names, '|') . ')';
 
// 中略
 
elseif (preg_match("#^$host_names_re\.([\w\-]+\.)*?[\w\-]+\.[a-z]{2,4}((:[0-9]*)?/[^ \"\n\r\t<]*)?#i", $path, $matches))
 
{
 
   return "http://" . $matches[0];
 
}  |