Inspectopedia Help

Duplicate branch in alternation

Reports duplicate branches in a RegExp alternation. Duplicate branches slow down matching and obscure the intent of the expression.

Example:

(alpha|bravo|charlie|alpha)

After the quick-fix is applied:

(alpha|bravo|charlie)

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.

RegExpDuplicateAlternationBranch
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 | RegExp

New in 2017.1

Last modified: 27 August 2024