<?xml version="1.0" encoding="windows-1252"?>
<node id="948445" title="Re^3: Perl Regex Repeating Patterns" created="2012-01-17 19:07:26" updated="2012-01-17 19:07:26">
<type id="11">
note</type>
<author id="634253">
AnomalousMonk</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;i&gt;
The following regex worked properly. ... If there is a better way to do this ...
&lt;/I&gt;&lt;/BLOCKQUOTE&gt;

&lt;p&gt;
Even after adding (just for the heck of it) a closing &lt;c&gt; } &lt;/C&gt; brace, all I get is an infinite loop. What code are you running?
&lt;/P&gt;

&lt;c&gt;
&gt;perl -wMstrict -le
"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];
 print 0+@index; &lt;STDIN&gt;;
 }
 }
"
1

2

3

4

5

...

Terminating on signal SIGINT(2)
&lt;/C&gt;

</field>
<field name="root_node">
948417</field>
<field name="parent_node">
948423</field>
</data>
</node>
