Back to Intellij Community

RedundantEscapeInRegexReplacement

java/java-impl/resources/inspectionDescriptions/RedundantEscapeInRegexReplacement.html

2025.3-rc-2341 B
Original Source

Reports redundant escapes in the replacement string of regex methods. It is allowed to escape any character in a regex replacement string, but only for the $ and \ characters is escaping necessary.

Example:

string.replaceAll("a", "\\b");

After the quick-fix is applied:

string.replaceAll("a", "b");

New in 2022.3