in reply to Re: Perl Regex Repeating Patterns
in thread Perl Regex Repeating Patterns
Thanks for the response. The following regex worked properly. I realize that using a quantifier after a capture group is bad programming practice, but I do not know how else to do what I want
If there is a better way to do this, please let me know. Thanks.my $string="AAABBBCCCCDDDEEEFFFGGGHHHIII"; my @patterns=('BBB','DDD'); my @index; foreach(@patterns){ while($string=~m/\G([A-Z]{3})+?$_/g){ push(@index,$-[2]); pos($string)=$-[2]; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Perl Regex Repeating Patterns
by AnomalousMonk (Archbishop) on Jan 18, 2012 at 00:07 UTC | |
|
Re^3: Perl Regex Repeating Patterns
by Corion (Patriarch) on Jan 18, 2012 at 08:01 UTC |