Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Perl Complains of Nested Quantifiers

by AnomalousMonk (Abbot)
on May 22, 2012 at 23:14 UTC ( #971908=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Perl Complains of Nested Quantifiers
in thread Perl Complains of Nested Quantifiers

A concern was expressed about "catastrophic backtracking." I'm curious about ... whether your solution would satisfactorily avert it.

It would not. AFAIU, possessive quantifiers like  ++ *+ ?+ {n,m}+ are just special, limited cases of the general  (?>...) atomic grouping. See example below.

>perl -wMstrict -le "my $s = 'foobazbazbaz foobazbazbaz'; print 'match 1' if $s =~ m{ foo (?> (?:baz)+) baz }xms; print 'match 2' if $s =~ m{ foo (?> .* baz) baz }xms; "
(no output)


Comment on Re^3: Perl Complains of Nested Quantifiers
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://971908]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2015-07-07 21:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls