In the code below I'm trying to replace in text occurrences of fromString withtoString, but no replacement takes place. How to set the parenthesis in the regex to make this work?
public static void main(String[] args) {
String fromString = "aaa(bbb)";
String toString = "X";
String text = "aaa(bbb) aaa(bbb)";
String resultString = text.replaceAll(fromString, toString);
System.out.println(resultString);
}