On Tue, 2 Mar 2021 at 08:58, Joel Jacobson <j...@compiler.org> wrote:
> If we stipulate that the result array will be in order, then you still > don’t have the exact location of empty matches but you do at least have > where they are relative to non-empty matches. > > > This part I didn't fully understand. Can you please provide some example > on this? > Suppose the match results are: [4,8) [10,10) [13,16) [20,20) [24,24) Then this gets turned into: [4,8) empty [13,16) empty empty So you know that there are non-empty matches from 4-8 and 13-16, plus an empty match between them and two empty matches at the end. Given that all empty strings are identical, I think it's only in pretty rare circumstances where you need to know exactly where the empty matches are; it would have to be a matter of identifying empty matches immediately before or after a specific pattern; in which case I suspect it would usually be just as easy to match the pattern itself directly. Does this help?