Forum Moderators: coopster
I want to send text to a function which can make my text url clickable links.
I have found this function
PHP Code:
function makeClickableLinks($text) {
$text = eregi_replace('(((f¦ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'<a href="\\1">\\1</a>', $text);
$text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'\\1<a href="http://\\2">\\2</a>', $text);
$text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})',
'<a href="mailto:\\1">\\1</a>', $text);
return $text;
}
it works fine for text urls but it destroys my html links in which i have give proper hyperlink tags values.
can anybody help with fixing this function so it makes text clickable urls but also dont disturb my html links?
thank you