Skip to content

Alternation within groups #7

Description

@jcgoble3

The ability to use | for regex-style alternation within groups would be nice. Probably can use a modified version of match_balance to find the end of the group, then match until encountering | or ). On success, make a recursive call to match beginning at the end of the group. If that returns success, pass it up the chain, else on NULL backtrack to the start of the group in the source string and attempt matching in the next alternative.

The major problem will be correctly counting capture groups, including capture groups passed over in unused alternatives. Also, need to handle groups that don't participate in the match (return nils in match table, but how to handle gsub() and :expand()?).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions