Could you instead pass Pattern.DOTALL to Pattern.compile?
This takes care of other cases (like '\r' only newlines on Mac).

http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#compile(java.lang.String, int)
http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#DOTALL