Hello,
I think you should use a regex function:
ereg_replace($regex_find, $regex_replace, $your_string);
I would strip all the tags except the <br>'s, then use the regex function to change many <br>'s in a row into a single newline:
$newtext = nl2br(ereg_replace("(<br\s?/?>)+", "\n", strip_tags(trim($buffer), '<br>')));
You could also use the Perl-style regex, preg_replace(). Slightly different syntax.
The \s?/? would match XML-friendly <br>'s, <br/> and <br />
HTH