I request that JDK-7171390 be closed, since there is a typo in the bug report
Copied from the bug report > 1 - String r1="blah - * ^% $^& [gf]".replaceAll("[a-zA-Z0-9]", "-"); > 2 - String r2="blah - * ^% $^& [gf]".replaceAll("[0-9a-zA-z]", "-"); The regex from String r2 specifies A-z, instead of A-Z. The range A-z includes [ ] \ ^ _ ` This explains why more characters are replaced in the output of r2. Best regards.