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 27, 2011 11:54
Subject:
Re: [perl #92898] (*THEN) broken inside condition subpattern
Message ID:
CALJW-qFkHzH4i4sPAbykuUHGv60Om3XDOC=yAdL02GF7wkhFow@mail.gmail.com
On Tue, Sep 27, 2011 at 2:44 PM, Eric Brine <ikegami@adaelis.com> wrote:

> On Tue, Sep 27, 2011 at 1:22 AM, Father Chrysostomos via RT <
> perlbug-followup@perl.org> wrote:
>
>> On Mon Sep 26 20:04:14 2011, ikegami@adaelis.com wrote:
>> > 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 (*THEN)] 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.
>>
>> *at the current starting position*
>>
>
> How can you check at what position it failed? I don't even know what that
> means (and this is in our documentation).
>

Ok, I understand what the docs are *trying* to convery.

The docs aren't just unclear, they are self-contradictory. In two places,
even!

   - Failing outright is exactly the opposite the failing for only one start
   position.
   - Allowing no further backtracking to take place is the opposite of
   allowing backtracking to try at a different start position.

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