Not 100% sure what you are asking. Can you post an example of the HTML you get after the RegEx?
This will remove excess white space.
preg_replace( '~\s{2,}~', '', $str );
You could also look at PHP DOM (PHP Manual). Load the HTML into that and then set preserveWhiteSpace and formatOutput to false.
Addition:
preg_replace( '~\s+\n+\s+\n+~', "\n", $str );
Will do it I think. But as mentioned you can do this with PHP DOM, and it will be more flexible.
$doc = new DOMDocument();
$doc->loadHTML( $html );
$doc->preserveWhiteSpace = true; // Or false?
$doc->formatOutput = true;
echo $doc->saveHTML();