regular expressions are required, here in a function...
PHP Code:
<?
function parse_urls($str){
$str=eregi_replace("([ \r\n])www\\.([^ ,\r\n]*)"," <a href=\"http://www.\\2\">\\2</a>",$str);
$str=eregi_replace("^www\\.([^ ,\r\n]*)","<a href=\"http://www.\\1\">\\1</a>",$str);
$str=eregi_replace("([ \r\n])http://([^ ,\r\n]*)"," <a href=\"http://\\2\">\\2</a>",$str);
$str=eregi_replace("^http://([^ ,\r\n]*)"," <a href=\"http://\\1\">\\1</a>",$str);
return $str;
}
echo parse_urls('www.this.com and now http://www.that.com');
?>