Skip to content

Support interpolating a subroutine definition group via pattern #34

@slevithan

Description

@slevithan

Two things combine to prevent interpolating subroutine definition groups via pattern:

  1. Interpolated patterns are always wrapped in (?:…).
  2. Subroutine definition groups must appear at the very end of the expression, not counting the comments and whitespace allowed via implicit flag x.

One way to fix this would be to update interpolation to check whether, when interpolating a pattern, its value starts with ( and ends with ). If so, it doesn't need to be wrapped. This would have the additional benefit of cleaner source for some regexes that interpolate patterns, even if they don't use subroutine definition groups.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions