in reply to Regex not greedy enough

Use the /s modifier rather than /m. See the top of perlman:perlre.