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

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

Thread Previous | Thread Next
Eric Brine
September 26, 2011 20:03
Re: [perl #92898] (*THEN) broken inside condition subpattern
Message ID:
On Sat, Sep 24, 2011 at 9:41 AM, Father Chrysostomos via RT <> wrote:

> On Sun Sep 18 13:33:28 2011, sprout wrote:
> > On Mon Sep 12 06:24:25 2011, 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:



Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About