"." does not capture line break characters in JS. Other languages allow you to configure what "." captures, but JS doesn't. The standard way around this is by using the \s\S convention.

http://www.regular-expressions.info/dot.html