develooper Front page | perl.perl5.porters | Postings from June 2013

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

Thread Previous | Thread Next
June 23, 2013 11:18
Re: [perl #92898] (*THEN) broken inside condition subpattern
Message ID:
On Sat, 22 Jun 2013, demerphq wrote:

> Sorry about the incredibly laggy reply. :-(

Hi Yves,

No problem; glad somebody has picked this up. For myself, I can no 
longer remember exactly what I was complaining about! 

> I think you are right that perl thinks differently to you. Probably
> because of implementation details.

Thanks for taking the time to give a long explanation of the way Perl 
works, which indeed is different to the way PCRE works - and of course 
it's far too late to change that now.

In a recent release of PCRE we have formulated some reasonably 
consistent rules for way that backtracking verbs are handled, and 
documented them. In many cases the behaviour is the same as Perl's, but 
there are some differences.

> Anyway, I can see how it would be reasonable to consider (?:foo) to be
> an alternation with only one branch, but to Perl it isnt, and that is
> how you should interpret the verb operators.

PCRE does now get this (perhaps not 100%, but to some extent) "right" in
its current treatment of (*THEN). The documentation even says this: "A 
subpattern that does not contain a | character is just a part of the    
enclosing alternative; it is not a nested alternation with only one      


Philip Hazel

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