文字列があり、メソッドを実行しようとすると、次のreplaceAll
奇妙なエラーが発生します。
String str = "something { } , op";
str = str.replaceAll("o", "\n"); // it works fine
str = str.replaceAll("{", "\n"); // does not work
そして私は奇妙なエラーを受け取ります:
Exception in thread "main" java.util.regex.PatternSyntaxException:
Illegal repetition {
の発生をどのように置き換えることができ"{"
ますか?