Re: [pcre-dev] several messages

Top Page

Reply to this message
Author: ph10
Date:  
To: ND
CC: Pcre-dev
Subject: Re: [pcre-dev] several messages
On Sat, 22 Jun 2019, ND via Pcre-dev wrote:

> /\A(?:a|(?=b)|.){50}\z/
> abc
> 0: abc
>
> when engine in a strange way decides that it was exactly 50 repetitions.


That is not an unlimited repeat, so there is no special action for
matching an empty string. Therefore, (?=b) matches 47 times. A fixed
repeat quantifier is exactly the same as writing the group multiple
times. That is (xxx){3} is, in effect, (xxx)(xxx)(xxx) [except the group
number is the same] so you can see why

/\A(?:a|(?=b)|.)(?:a|(?=b)|.)(?:a|(?=b)|.) ...etc ...\z/

matches "abc".

> Perl-compatibility is important. So, indeed. If there is no one who can
> discuss this issue with Perl-authors or to examine the issue of breaking some
> PCRE-compatibility to achieve more logic.


I do not think the Perl people would want to make changes, and I have to
say that I agree.

Philip

--
Philip Hazel