Regex issues in Node

I have been trying to use Regex to select a block of an XML based .NET Core CSPROJ file, and yes before you say know I could use XPATH, but why am not is another story.

I was trying to use the Regex

content.match(/<PropertyGroup>((.|\n)*)<\/PropertyGroup>/gmi)

The strange thing was this selection string worked in online Regex testers and in online Javascript IDEs, but failed inside my Node based Azure DevOps Pipeline extension.

After much experimentation I found that the following line worked

content.match(/<PropertyGroup>([\s\S]*?)<\/PropertyGroup>/gmi)


Well that a a good few hours of my life I won’t get back. No idea why Node handles the wildcards differently