Replacing "\\ n" in Java string
I have the following piece of code:
String text = "Category:Bishopsq\\nxof La2on</target></link></sentence>\\n</paragraph><paragraph>".toString().replaceAll("(\n|\\n)", "").trim().replaceAll("\\<.*?>", " ").replaceAll("[^a-zA-Z]", " ").trim().replaceAll(" +", " ").toLowerCase();
System.out.println(text);
I am getting the following output:
category bishopsq nxof la on n
However, I need the following output:
category bishopsq xof la on
It replaces everything incorrectly \\n
. What am I doing wrong?
+3
source to share