I know its a bit long. I'm trying to catch up on a deadline and if anyone could help me, I would gladly appreciate it. Another friend programmer of mine made this PHP script but unfortunately its already deprecated and doesn't work. Can anyone convert this to preg? I know nothing about eregi, preg, rejex, etc.
function tolink($text){
$text = " ".$text;
$text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'<a href="\\1" target="_blank" rel="nofollow">\\1</a>', $text);
$text = eregi_replace('(((f|ht){1}tps://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'<a href="\\1" target="_blank" rel="nofollow">\\1</a>', $text);
$text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'\\1<a href="http://\\2" target="_blank" rel="nofollow">\\2</a>', $text);
$text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4})',
'<a href="mailto:\\1" rel="nofollow">\\1</a>', $text);
return $text;
}