Inspectopedia Help

Redundant escape in regex replacement string

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

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023