I have a problem with the replaceAll for a multiline string:
String regex = \"\\\\s*/\\\\*.*\\\\*/\"; String testWorks = \" /** this should be replaced **/ j
You need to use the Pattern.DOTALL flag to say that the dot should match newlines. e.g.
Pattern.DOTALL
Pattern.compile(regex, Pattern.DOTALL).matcher(testIllegal).replaceAll("x")
or alternatively specify the flag in the pattern using (?s) e.g.
(?s)
String regex = "(?s)\\s*/\\*.*\\*/";