I got the following code which replaces URL by the corresponding links:
$in = array
(
'/(?:^|\b)((((http|https|ftp):\/\/)|(www\.))([\w\.]+)([,:%#&\/?=\w+\.-]+))(?:\b|$)/is'
);
$out = array
(
"<a href=\"$1\" target=\"_blank\">$1</a>"
);
return preg_replace($in, $out, $url);
However, I do not wish that URLS inside a SRC="url" atribute are converted into links.
How can I exclude URL enclosed inside an attribute from this pattern?
UPDATE: input would be:
Bellow you can see http://www.yahoo.com bla bla
<iframe src="http://yahoo.com"></frame
It need o parse the first link but not the URL inside the src=""