Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个代码:
buffer = buffer.replaceAll("(","");
那是回来java.util.regex.PatternSyntaxException了,我不知道为什么。请帮忙。
java.util.regex.PatternSyntaxException
替换replaceAll("(","")为replaceAll("\\(", "")。(是一个特殊字符,你应该\\在每个\.[]{}()*+-?^$|.
replaceAll("(","")
replaceAll("\\(", "")
(
\\
\.[]{}()*+-?^$|
"sta(c(k(overfl(ow".replaceAll("\\(", "") -> "stackoverflow"