我对多行字符串的 replaceAll 有疑问:
String regex = "\\s*/\\*.*\\*/";
String testWorks = " /** this should be replaced **/ just text";
String testIllegal = " /** this should be replaced \n **/ just text";
testWorks.replaceAll(regex, "x");
testIllegal.replaceAll(regex, "x");
以上适用于 testWorks,但不适用于 testIllegal!?为什么会这样,我该如何克服?我需要替换跨越多行的注释 /* ... */ 之类的内容。