Thanks. The \n must be included, so the greedy variant must be used.
I have been using Perl for so many years, but it is a scary thought that I seem to have missed the part that says "or just before the newline at the end of the string".
--need to urgently check some existing code now--