Many on the internet suggest emulating variable length lookbehind by using lookaheads (see for example Dr. Regex: Variable-Length Lookbehinds: actually possible in Perl/PCRE!). Is it possible to implement such a solution by doing the conversion internally?
Ze'ev Atlas On Tuesday, January 19, 2021, 12:01:32 PM EST, <ad...@bugs.exim.org> wrote: https://bugs.exim.org/show_bug.cgi?id=547 --- Comment #5 from Philip Hazel <philip.ha...@gmail.com> --- Fixed-length lookbehind is (relatively) simple: you move back a fixed number of characters, then apply the normal matching algorithms. That's what PCRE and Perl (until recently) do. I see that Perl 5.3 has some experimental support for variable length. The documentation says this: "Prior to Perl 5.30, it worked only for fixed-width lookbehind, but starting in that release, it can handle variable lengths from 1 to 255." It goes on to say that this is experimental and may be removed if insurmountable problems arise. I have no idea how it is implemented, but the 255 limit suggests it is perhaps trying a minimum length and then continuing to move backwards (up to the limit). If something similar were implemented in PCRE I'm sure the performance would be lousy. -- You are receiving this mail because: You are on the CC list for the bug. -- ## List details at https://lists.exim.org/mailman/listinfo/pcre-dev -- ## List details at https://lists.exim.org/mailman/listinfo/pcre-dev