I hope someone can help me with this problem. I am writing a script that can underline URL's in it. I have now the following:
$text = eregi_replace('(http:\/\/|ftp:\/\/)(www.|ftp.|users.|home.)([A-Za-z\d])(.[A-Za-z]{2,3})(\/?[A-Za-z\/.~]*)( |<br>|$)', '<a href="\1\2\3\4\5">\2\3\4\5</a>\6', $text);
But when the url hasn't a http: or ftp: before it, I get very weird things. I get urls like this:
http://www.phrea.com/1www.xof.nl (phrea.com is the site wherefrom I run the script). I tried many things, but none worked. I know it has to do with the fact that \1 doesn't excist when I don't put a http:// before it.
I've already used the search function, but I didn't finf any usefull posts.
Thank you in advance,
Bart Coppens