|
Maybe you should take advantage of preg_replace_callback:
[PHP]function remove_br_tags($matches) {
return preg_replace("/<br>/", "", $matches[0]);
}
$str = "blah1<br>blah2 blah3 <pre>asdf<br>123<br></pre> blah4 blah5<br>blah6";
$str = preg_replace_callback("/<pre>.*?<\/pre>/", "remove_br_tags", $str);[/PHP]
|