Forum Moderators: coopster
function Replace($matches)
{
return strpos [php.net]($matches[0],"http://") === FALSE? "" : $matches[0];
}
$Pattern = "#<a.*>.*</a>#iU";
$NewText = preg_replace_callback [php.net]($Pattern,"Replace",$Text);
$Pattern = "#<a.*>.*</a>#iUms";
[edited by: adb64 at 10:00 am (utc) on April 26, 2007]
if you want to keep the text change code to this:
function Replace($matches)
{
return strpos($matches[0],"http://") === FALSE? $matches[1] : $matches[0];
}
$Pattern = "#<a.*>(.*)</a>#iU";
$NewText = preg_replace_callback($Pattern,"Replace",$Text);