← All recipes
Moderne licensed

Use bracket access for `re.Match` groups

Recipe IDorg.openrewrite.python.cleanup.UseGetitemForReMatchGroupsArtifactopenrewrite-static-analysis

Replace `match.group(n) with match[n]` to use the shorter subscript syntax available since Python 3.6.

Single recipeProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.python.cleanup.UseGetitemForReMatchGroups

If the recipe isn’t available locally, install it with:

mod config recipes pip install openrewrite-static-analysis