On 2016-12-16 02:20, Paul Eggert wrote: > Andreas Schwab wrote: >>> Another library is in that list: >>> >>> - The GNU C library, which ordinarily uses a DFA but which uses >>> backtracking if needed. >> But it doesn't support a gap. > > True, but none of the others do either. Only the old glibc code > (which survives only in Emacs now) does that, as far as I know. TRE does. > I doubt whether it'd be that hard to add gap support to any regexp > matcher, as it's simply interposing an address calculation. I did ask both the Oniguruma and the RE2 people; neither were optimistic (admittedly, my question was about supporting a slightly more general form than 2 chunks). In RE2, there are optimizations like using memchr to find the next character within a memory region, which are tricky to use if address calculations are added into the mix. Clément.