Author: Ze'ev Atlas Date: To: email@example.com, firstname.lastname@example.org Subject: Re: [pcre-dev] [Bug 547] full regular expression support inside
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?
On Tuesday, January 19, 2021, 12:01:32 PM EST, <admin@???> wrote:
--- Comment #5 from Philip Hazel <Philip.Hazel@???> ---
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.