<?xml version="1.0" encoding="windows-1252"?>
<node id="971064" title="Re: reg. expr. multiple substitutions" created="2012-05-17 10:06:24" updated="2012-05-17 10:06:24">
<type id="11">
note</type>
<author id="888573">
Eliya</author>
<data>
<field name="doctext">
&lt;p&gt; You could alias &lt;c&gt;$_&lt;/c&gt; to &lt;c&gt;$str&lt;/c&gt;, which would allow you to at least get rid of the repetitive &lt;c&gt;"$str =~ "&lt;/c&gt; part in every line. &lt;/p&gt;
&lt;p&gt; Other than that, you do have to declare somehow what to replace with what, and this get can hardly get any more compact than a list of &lt;c&gt;s/.../.../&lt;/c&gt; (unless there is some pattern or regularity in the tag-substitution pairs that would allow you generate them automatically &amp;#8212; but I suppose the ones given are not the real ones). &lt;/p&gt;
&lt;c&gt;
for ($str) {
    s/tag1/subst1/;
    s/tag2/subst2/;
    s/tag3/subst3/;
    ...
    s/tag49/subst49/;
}
&lt;/c&gt;</field>
<field name="root_node">
971059</field>
<field name="parent_node">
971059</field>
</data>
</node>
