Unclosed group near index

阅读更多
问题描述
- There is some exceptions in 'XmlUtil.getRegex' : 替换所有的注释字符
- java.util.regex.PatternSyntaxException: Unclosed group near index 77


String ss = "dddd(java)hello";  
//下面就会报错  
System.out.println(ss.replaceAll("(java)", "")); 

改为
String ss = "dddd(java)hello";  
//正解  
System.out.println(ss.replaceAll("\\(java)", "")); 

你可能感兴趣的:(java)