Regex is not required for this; If I were you, I would use ...
singleLine=singleLine.replace("\\\\n", "");
Many people think that the replace method replaces only one, but in fact the only difference is that replaceAll uses regex, and instead of replacing it simply replaces the exact string matches.
If you really want to use the regex, I think you need to do \\\\\\\\ (you have to "collapse" the escape character in Java and in regex, so x4, not just x2)
Explaining this a little more
The only problem in your example: you never set singeLine to anything; I'm not sure if you hid it or missed it.
Edit: Explaining the reasoning for \\\\\\\\ a few more, Java requires you to "\\" represent one \. Regex is also used for the \ character and requires you to do the same for it. If you're just “\\” in Java, the regex parser gets “\”, it skips the character for certain things. You have to give the regexp parser two of them to avoid it, so in Java you need to do "\\\\" to represent a match for one "\"
source share