in reply to Perl Complains of Nested Quantifiers
The 'atomic' extended pattern "(?>pattern)" (available in 5.8) will give you possessiveness around the entire pattern or any sub-pattern of your choosing. See Extended Patterns in perlre. (The following example doesn't really illustrate atomic/possessive matching; for a good discussion and pertinent examples, see the docs.)
>perl -wMstrict -le "print qq{perl ver. $]}; my $rx = qr{ ((?> \d+)) }xms; 'abc1234def' =~ $rx; print qq{'$1'}; " perl ver. 5.008009 '1234'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl Complains of Nested Quantifiers
by Kenosis (Priest) on May 22, 2012 at 20:01 UTC | |
by demerphq (Chancellor) on May 22, 2012 at 21:38 UTC | |
by AnomalousMonk (Archbishop) on May 22, 2012 at 23:14 UTC |