This has been asked several times for several languages but I can\'t get it to work. I have a string like this
String str = \"This is a string.\\nThis is a l
This should work. You need to put in two slashes
str = str.replaceAll("(\\r\\n|\\n)", "");
In this Reference, there is an example which shows
private final String REGEX = "\\d"; // a single digit
I have used two slashes in many of my projects and it seems to work fine!