Inspectopedia Help

Unnecessary non-capturing group

Reports unnecessary non-capturing groups, which have no influence on the match result.

Example:

Everybody be cool, (?:this) is a robbery!

After the quick-fix is applied:

Everybody be cool, this is a robbery!

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.

RegExpUnnecessaryNonCapturingGroup
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 2021.1

Last modified: 27 August 2024