<? $url = "http://www.java2java.com"; $www_url = ereg("^(http://www)\.([[:alnum:]]+)\.([[:alnum:]]+)", $url, $regs); if ($www_url) : echo $regs[0]; print "<br>"; echo $regs[1]; print "<br>"; echo $regs[2]; print "<br>"; echo $regs[3]; endif; ?>