I have a problem with this in other ways excellent code that I have managed to splice from several sources. It's purpose is to make a number of http/ftp/mailto-links in a piece of text clickable. It works well, but I have a problem. I assumes that all links end by the next space. How do I convert it render links that end on other characters corretly? These could be point(.), comma (,) and ) plus others that I have not thought of or met yet.
This is my function, which works well in 99.5% of the cases:
function make_clickable($text)
{
$text = eregi_replace("((http|mailto|ftp):\/\/[[:space:]<>]{1,})", "<A HREF='\1'>\1</A>", $text);
return($text);
}
Thanks
Martin