Just adding this for completeness, because the 2 backslash thing is real.
Refer to @dasblinkenlight answer in the following SO question (talking about \t but it applies for \n as well):
java, regular expression, need to escape backslash in regex
"There are two interpretations of escape sequences going on: first by the Java compiler, and then by the regexp engine. When Java compiler sees two slashes, it replaces them with a single slash. When there is t following a slash, Java replaces it with a tab; when there is a t following a double-slash, Java leaves it alone. However, because two slashes have been replaced by a single slash, regexp engine sees \t, and interprets it as a tab."