Skip to content

Unused empty capture group in regex pattern #67

Open

Description

@elharo

Description

In MappingUtils.java:90, the RegexBasedInterpolator is constructed with:

new RegexBasedInterpolator("\\@\\{(", ")?([^}]+)\\}@");

The prefix contains an opening ( and the suffix starts with )?, forming an empty optional capture group ()? that spans across the interpolator's internal key capture pattern. This group is never used for anything and is functionally dead regex.

The same result could be achieved with the simpler:

new RegexBasedInterpolator("\\@\\{", "\\}@");

Impact

No functional impact, but the unnecessary complexity obscures the intent and may confuse future contributors.

Relevant code

src/main/java/org/apache/maven/shared/mapping/MappingUtils.java:90

Activity

  1. self-assigned this
    on Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions