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

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Java, 241.16690

Last modified: 29 April 2024