Q:

Java regex - The Escape Character Followed By The Double Backslahes Or Single?

I'm currently learning about the java regex and I'm a bit confused about the escape characters. I have read that the java regex is basically a two steps process, firstly the string parser processes the string and then the regex. So that's the reason why the double backslahes are needed in patterns. 
However, I wonder what is the difference between the escape character followed by the double backslahes and single. For example:
Pattern pattern = Pattern.compile("\\ntest");

and
Pattern pattern = Pattern.compile("\ntest");

It seems to work the same, since the matcher returns true either way;
Matcher match = pattern.matcher("\ntest");

So is there any significant differences? 

A:

There is no difference.
The "\\n" means you send \n string to the regex engine. See the Java regex syntax help:

\n    The newline (line feed) character ('\u000A')

The "\n" means you send an LF symbol to the regex engine. Since it has no special meaning, it matches itself.
So, both "\\n" and "\n" string literals used as regex patterns match the same thing.

