Hello,
I have clickable url function which convert text into clickable urls. All works fine except it fails in one condition. Here is the code
This function fails when using it founds this type of text.. <a href="http://url.com">http://url.com</a>
some one told me to use "Put the "a href" part back in" I tried but not luck.
Please help me
I have clickable url function which convert text into clickable urls. All works fine except it fails in one condition. Here is the code
Code:
function make_clickable_urls($text) {
$text = preg_replace("/(?<!<a href=\")((http|ftp)+(s)?:\/\/[^<>\s]+)/i", "<a href=\"\\0\" target=\"_blank\">\\0</a>", $text );
$text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'\\1<a href="http://\\2" target="_blank">\\2</a>', $text);
$text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})',
'<a href="mailto:\\1" target="_blank">\\1</a>', $text);
return $text;
}
some one told me to use "Put the "a href" part back in" I tried but not luck.
Please help me
Comment