in reply to Re^2: Getting + and * to generate multiple captures
in thread Getting + and * to generate multiple captures
For that very specific regexp, yes. That's the simplification to which I alluded. I'll repeat the reason I didn't post the simplification
It's much safer to assume there's always the possibility of backtracking through any (?{...}). That's why $^R is used.
It's too easy to miss a case where backtracking can occur.
For example,
/ $text (?: \s (\w+) (?{ push @matches, $^N }) ){2,} / is wrong.
/ $text (?: \s (\w+) (?{ push @matches, $^N }) )+ ... / is wrong.
/ $text (?: \s (\w+) (?{ push @matches, $^N }) ... )+ / is wrong.
|
|---|