How can I loop through a string, replacing sections that match a pattern?
<p>I have the following HTML markup</p>

<pre><code>&lt;p&gt;xxxx&lt;/p&gt;
 &lt;pre&gt;xxx&lt;/pre&gt;
 &lt;p&gt;xxxx&lt;/p&gt;
 &lt;pre&gt;yyy&lt;/pre&gt;
</code></pre>

<p>I need to be able to change this to:</p>

<pre><code>&lt;p&gt;xxxx&lt;/p&gt;
 &lt;pre&gt;ABC xxx ABC&lt;/pre&gt;
 &lt;p&gt;xxxx&lt;/p&gt;
 &lt;pre&gt;ABC yyy ABC &lt;/pre&gt;
</code></pre>

<p>I had a suggestion to use:</p>

<pre><code>   var loDoc = XDocument.Parse(lcHTML);
   foreach (XElement loElement in loDoc.Descendants("pre"))
</code></pre>

<p>This does extract all the pre elements but it doesn't give me a way to tie things together and reinsert code into the original string. </p>

<p>Is there another way I could do this that would allow me to make the code change I need. I was thinking of using split and splitting on the <code>&lt;pre&gt;..&lt;/pre&gt;</code> but then that would not really give me what I need as I need to replace the code inside the <code>&lt;pre&gt;...&lt;/pre&gt;</code></p>
