Re: [pcre-dev] Forward reference don't work when repeated tw…

Top Page
Delete this message
Author: Philip Hazel
Date:  
To: Graycode
CC: Pcre-dev
Subject: Re: [pcre-dev] Forward reference don't work when repeated twice or more
On Mon, 21 Nov 2011, Graycode wrote:

> > PCRE version 8.20 2011-10-21
> > /(a)(?2){2}(.)/
> > abcd
> > No match
> >
> > It seems that the whole string 'abcd' must be matched.
>
> There appears to be an ambiguous issue with PCRE's determination of
> what-to-repeat.


No, that was not the case, as I immediately saw when I ran the test with
the -d option. It showed this:

Capturing subpattern count = 2
No options
First char = 'a'
Need char = 'a'

That last line is wrong. There is no need for a further 'a' later in the
string.

> The compile seems to require another 'a' down the road.


Exactly!

The fix was trivial ... I posted the patch.

Philip

--
Philip Hazel