Is there any way to use raw strings in Java (without escape sequences)?
(I\'m writing a fair amount of regex code and raw strings would make my code immensely more r
I use Pattern.quote. And it solves the problem of the question. Thusly:
Pattern pattern = Pattern.compile(Pattern.quote("\r\n?|\n"));
The quote method returns a string that would match the provided string argument, which the return string is the properly quoted string for our case.