How to replace all "(" and ")" in a string with a fullstop, in Java? I tried in the following way:
String url = "https://bitbucket.org/neeraj_r/url-shortner)";
url.replaceAll(")", ".");
url.replaceAll(")", ".");
But it does not work. The error is:
Exception in thread "main" java.util.regex.PatternSyntaxException: Unmatched closing
')'
)
at java.util.regex.Pattern.error(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.util.regex.Pattern.<init>(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.lang.String.replaceAll(Unknown Source)
at com.azzist.cvConversion.server.URLChecker.main(URLChecker.java:32)
I think this problem will be there in all regex too. Adding \
before )
did not work.