Re: [pcre-dev] Remove some restrictions of lookbehind assert…

Top Page

Reply to this message
Author: ph10
Date:  
To: ND
CC: Pcre-dev
Subject: Re: [pcre-dev] Remove some restrictions of lookbehind assertions
On Sat, 3 Aug 2019, ND via Pcre-dev wrote:

> May be it can be useful to have ability to set a limits of lookbehind search
> for performance reasons.
> I can imagine a rule: If nonfixedlength lookbehind immediately preceded by
> capture group, then it is restricted to start position of this group.


Non-fixed-length lookbehinds are almost certainly never going to be
implemented with the current PCRE2 design. It was originally invented
for Perl-4 patterns and is very much left-to-right oriented. Note that
when Perl-5 invented lookarounds, they also restricted lookbehinds to
fixed length, and I presume Perl implements them in the same way: move
back a fixed number of characters, then run the lookbehind forwards.

Philip

--
Philip Hazel