http://www.perlmonks.org?node_id=971908


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)