Skip to content

Capturing Groups are Not Supported #21

@hyperpape

Description

@hyperpape

There's no particular obstacle, I just haven't implemented them, and I should.

The standard approach is to match capturing groups using the NFA, after using the DFA to find the matching substring (https://swtch.com/~rsc/regexp/regexp3.html). We can just do this, and it would be fine.

There's probably room for us to do something smarter though in many cases. The article gives the example of matching (\d+)-(\d)+-(\d+) against 650-253-0001, a case where we could identify submatches without using an NFA, by simply splitting on the - char in the region we match.

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