<?xml version="1.0" encoding="windows-1252"?>
<node id="543510" title="Re: Finding a repeating substring with a regex" created="2006-04-15 04:29:37" updated="2006-04-15 00:29:37">
<type id="11">
note</type>
<author id="145001">
kvale</author>
<data>
<field name="doctext">
First you must find the repeating unit. Try this:
&lt;code&gt;
use re 'eval';

$_ = q'abczdefzabcghijklzabczaerabrtyuabcethdauthabkudiabc';

if (/([a-z]{3}).+?\1/) {
    $unit = $1;

    m&lt;
    (
     (?{
         push @found, pos()
       })
     $unit
    )
    \G
    .+?
    \1
    &gt;gx;

    print join ', ', @found, "\n";
}
&lt;/code&gt;

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-145001"&gt;
&lt;p&gt;
 -Mark
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
543507</field>
<field name="parent_node">
543507</field>
</data>
</node>
