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 get the following output:
category bishopsq nxof la on n
However, I want the following output:
category bishopsq xof la on
It is not correctly replacing all \\n.
What am I doing wrong?
you need to escape the sign \, like this:
replaceAll("(\\n|\\\\n)", "")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With