mndrix/regex

grant access to captures

Closed this issue · 1 comments

There's currently no way to access captures via =~ syntax. Either expand it to support named captures which bind to surrounding variables. Or make a boring, numbered capture interface which places the captures in order, in a list.

One speculative interface is

regex(Pattern,Captures,Text)
regex(Pattern,Captures,Text0,Text)  % for inside DCGs

I especially like having a difference list version which works inside DCGs. It'd be handy to do something like this

foo -->
    game_console(Console),
    regex('games?').