我有一个关于多行字符串的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!为什么?如何解决?我需要替换跨越多行的注释 /*...*/。