I have below content in text file
some texting content
Test
I read it from
By default, the . character will not match newline characters. You can enable this behavior by specifying the Pattern.DOTALL flag. In String.replaceAll(), you do this by attaching a (?s) to the front of your pattern:
expectedString = inputString.replaceAll("(?s)\\",
"NewContent");
See also Pattern.DOTALL with String.replaceAll