I have a line that replace http://www.blah.com/ with a link using ereg_replace.
$text = "
This is a test <br/>
http://www.google.com/<br />
http://www.cnn.com/2007/SHOWBIZ/TV/06/26/hilton.release/index.html<br />
http://manage.hosted.filefront.com/live.php?page=fpad&redirect=http://www.filefront.com/<br />
http://files.filefront.com/Molten+Core+trip2mpg/;7880654;/fileinfo.html<br />
<a href=\"http://www.yahoo.com\">Yahoo</a>
";
$text = ereg_replace("([htps]+://[[a-zA-Z0-9_-]+\.]?[a-zA-Z0-9_/?&%-]+\.[a-zA-Z0-9_-]+/?[[a-zA-Z0-9+_:;=/?&%\.-]+]?)", "<a href=\"\\1\" target=\"_blank\">\\1</a>", $text);
echo $text;
The plain text links convert fine. But I need it so that it won't convert links inside href=
I try doing (!href=\") before the htps but did not work.