<?xml version="1.0" encoding="windows-1252"?>
<node id="1005026" title="Re: Replace the nth occurence" created="2012-11-21 18:16:33" updated="2012-11-21 18:16:33">
<type id="11">
note</type>
<author id="708738">
LanX</author>
<data>
<field name="doctext">
++[AnomalousMonk] for demonstrating what \K [id://1004848|is good for]! =)&lt;P&gt;


Maybe I'm boring ... but I prefer more explicit code with split-and-join over regex-acrobatics:&lt;P&gt;

&lt;c&gt;
my $nth = 4;
my $str = 'a,bb,ccc,dddd,eeeee,ffffff';
my @str= split /,/,$str;
$str = join ( "," , @str[0..$nth-1] ) . "|" . join ( "," , @str[$nth..$#str] );
print qq{'$str'};
&lt;/c&gt;&lt;P&gt;


&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-708738"&gt;
&lt;p&gt;Cheers Rolf
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1004836</field>
<field name="parent_node">
1004836</field>
</data>
</node>
