I have below regex to match a tag

```
str.match(/<xsl:template(.+?)xsl:template>/g);

```

But problem is if I have newlines in between those two tags, it's not matching anything. So I am preparing string like this before 

```
str = str.replace(/(\s{2,}|\t)/g, ' ').replace(/(\r\n|\n|\r)/gm,"");
str.match(/<xsl:template(.+?)xsl:template>/g); // Now it matches.

```

I have tried to merge it into one regex like below 

```
str.match(/<xsl:template(.+?|\r\n|\n|\r)xsl:template>/g);

```

But it does not work. Please help me to tweak this `/<xsl:template(.+?)xsl:template>/g` regex to match anything between tags.

The possible duplicate question in comments does not answer my question.