ereg_replace-2
<?php $url = "Java2s (http://www.java2s.com)"; $url = ereg_replace("http://([a-zA-Z0-9./-]+)([a-zA-Z/]+)", "<a href=\"\\0\">\\0</a>", $url); print $url; ?>