The expression looks a bit dodgy. Hang on a tick. I'll write this with comments. If you remove, the extra whitespace, and the escape characters protecting those three spaces in the comment, you can drop the x modifier.
'<\?xml # the start of the XML tag
.*?> # Assuming the XML declaration might change (?)
.*? # Generic Stuff
<!--\ /template\ topPage\ --> # Up to here.
'xs
Replace that with the empty string and that sounds like what you're originally asking for. It's not clear how your reply relates.