This is my regex. I want to find the opening and closing parentheses and replace them with "\(" and "\)".
word = word.replaceAll(Pattern.quote("("), "\\" + "(").replaceAll(Pattern.quote(")"), "\\" + ")");
This is the output if word = "word)":
New word is: word)
As you can see it didn't change a thing.