note
mikeirw
<p>I believe you want this:</p>
<code>
$ARRGH =~
s#<doct>Customer trans\.(?:.*)+?</doct>#<doct>Customer trans\.</doct>#g;
</code>
<p>What the <code>+?</code> does is makes the match less "greedy", so that it matches the first </doct> it finds instead of the last. Also, since you aren't using what you capture in <code>(.*)</code>, I put the <code>?:</code> in, so that perl doesn't try to retain what it found, but still keeps the grouping.</p>
<p><strike>I also changed the regex delimiter to <code>|</code> so that you don't have to escape the <code>/</code> in <code></doct></code>.</strike></p>
<p><strong>Update:</strong> As per [Aristotle]'s reply, I've changed the regex delimiter to <code>#</code>.</p>
214489
214489