How to replace all "(" and ")" in a string using fullstop in Java? I tried as follows:
String url = "https://bitbucket.org/neeraj_r/url-shortner)"; url.replaceAll(")", "."); url.replaceAll(")", ".");
But that will not work. Error:
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 in all regular expressions. Adding \ before ) does not work.
source share