develooper Front page | perl.perl5.porters | Postings from September 2011

Re: [perl #92898] (*THEN) broken inside condition subpattern

Thread Previous | Thread Next
From:
Eric Brine
Date:
September 26, 2011 20:03
Subject:
Re: [perl #92898] (*THEN) broken inside condition subpattern
Message ID:
CALJW-qGp1PtZ6FnHi5pg17QNAeJV4C=SdshWGw_pQwuGJ0PQjg@mail.gmail.com
On Sat, Sep 24, 2011 at 9:41 AM, Father Chrysostomos via RT <
perlbug-followup@perl.org> wrote:

> On Sun Sep 18 13:33:28 2011, sprout wrote:
> > On Mon Sep 12 06:24:25 2011, ph10@hermes.cam.ac.uk wrote:
> > > another oddity of (*THEN).
> > >
> > > Pattern: /a+?(*THEN)c/
> > > Subject: aaac
> > > Result:  Perl 5.012003 matches "aaac"
> >
> > That’s strange. In 5.14 it doesn’t match. I don’t know which is worse.
>

According to the 5.14.1 docs, it shouldn't match.

Note that if [the (*PRUNE)] operator is used and NOT inside of an
alternation then it acts exactly like the (*PRUNE) operator.

Consider the pattern A (*PRUNE) B, where A and B are complex patterns. Until
the (*PRUNE) verb is reached, A may backtrack as necessary to match. Once it
is reached, matching continues in B, which may also backtrack as necessary;
however, should B not match, then no further backtracking will take place,
and the pattern will fail outright at the current starting position.
The change occurred with this commit:

The following should match according to the docs:

/a+(*THEN)c/

/a+?(?=c)(*THEN)c/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About