Capture offset of matches in std.regex.matchAll?
Lewis
musicaljelly at gmail.com
Fri Sep 25 19:05:38 UTC 2020
On Monday, 7 July 2014 at 21:32:30 UTC, JD wrote:
> I'm using a compile time regex to find some tags in an input
> string. Is it possible to capture the offset of the matches in
> some way? Otherwise I have to "calculate" the offsets myself by
> iterating over the results of matchAll.
>
> Thanks,
> Jeroen
>
For anyone coming to this later, I believe the capture strings
are all slices. So you can do 'capture[1].ptr -
originalString.ptr' to get the index the capture starts at.
More information about the Digitalmars-d-learn
mailing list