I dislike your approach, for a few reasons:
- the "match X and replace it with itself" approach
- slow creeping of .*?
- breaks on embedded newlines
For these reasons, it is much better (and faster) to take the two-regex approach shown to you several times already.
japhy --
Perl and Regex Hacker