mndrix/regex

access to matched text

Closed this issue · 1 comments

This is different than access to the captures. Specifically, Vyacheslav wants this

from string '99 bottles of Beer' and pattern '[0-9]+ [a-z]+' get the string '99 bottles' or her position and length (1, 10)

I don't think this should be part of =~/2 so it should be part of the lower level interface. At the same time, look at pcre's and re2's interface to see what they make available about matched text.

I've decided that this is not need because issue #1 allows one to wrap the pattern in a capture to get the same results:

?- regex('([0-9]+ [a-z]+)', '99 bottles of Beer', [Matched]).
Matched = '99 bottles'.