The problem:
In Javascript Regular Expressions, the dot character (.) doesn’t truly represent any character. It leaves out new lines.
The solution:
Rather than using the dot character, try using [\s\S] which matches both whitespace and non-whitespace characters. This equates to a true “Any Character”.