Inspectopedia 2026.1 Help

Non-regex 'replaceAll()' can be replaced with 'replace()'

Reports calls to String.replaceAll() where the first argument is a plain (non-regex) string literal and the replacement is also a plain string literal. In such cases using String.replace() is clearer and avoids the overhead of regular expressions.

Example:

"a,b,c".replaceAll(",", ";");
"a,b,c".replace(",", ";");

Note: the inspection only suggests the replacement when it is safe, i.e., when the pattern contains no regular expression meta-characters and the replacement contains no special characters used by regex replacement like $ or \.

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

ReplaceAllNonRegex
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Java | Performance

Inspection ID: ReplaceAllNonRegex

New in 2026.1

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection ReplaceAllNonRegex

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2026.1, Qodana for JVM 2026.1,

Last modified: 31 March 2026