Forum Moderators: coopster
function make_clickable_urls($text) {
$text = eregi_replace('(((f¦ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'<a href="\\1" target="_blank">\\1</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;
}
echo make_clickable_urls('<a href="http://site.com">Site 1</a>, http://www.webmasterworld.com');
Any help?
Thanks
$text=preg_replace( "/(?<!<a href=\")((http¦ftp)+(s)?:\/\/[^<>\s]+)/i", "<a href=\"\\0\">\\0</a>", $text );
I can't get it working