in reply to Munging Rendered HTML While Preserving Formatting
I solved a problem of this kind at Re: Matching across newlines without stripping them out. That problem was simpler as it only preserved newlines (or any other characters), whereas you want to preserve tags. I don't recommend you to use it as it stands as HTML and regexes usually make a fragile combination, but it may provide some food for thought.
It's kind of a reversed approach of idsfa's Re^3: Munging Rendered HTML While Preserving Formatting.
Hope this helps,
ihb
|
|---|