How to replace ',)' with ')' I gave replaceAll(",)",")") but i was getting an error that Unmatched closing ')' near index 0. Please let me know if there is some solution to replace this.
replaceAll
uses regular expressions, and bracket have a particular meaning in regular expressions. Just use replace
instead, which doesn't use regex:
text = text.replace(",)", ")");
See more on this question at Stackoverflow