in reply to Perl Regex Repeating Patterns
Having a quantifier after capturing parentheses is almost always an error.
Maybe you want to directly populate your list?
my @matches = ($string =~ /([A-Z]{3})/g;
but that approach will not work if your input data contains non-alphabetical chars, like:
AAA..BBB
If you want a match to start at a specific position, see perlre on \G.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Perl Regex Repeating Patterns
by Anonymous Monk on Jan 17, 2012 at 21:43 UTC | |
by AnomalousMonk (Archbishop) on Jan 18, 2012 at 00:07 UTC | |
by Corion (Patriarch) on Jan 18, 2012 at 08:01 UTC |
In Section
Seekers of Perl Wisdom