Script to replace HTML elements by ID or class in lots of HTML files
<p>after a website mirrored using HTTrack, there is lots of ads. I just want to replace that ads by ID or class, or by text, using script (Perl, Python, Ruby, etc), or any other way</p>

<p>Does anyone know what script can do this job?</p>

<p>Thanks in advance.</p>

<p><strong>--new added below--</strong></p>

<p>I will use as example in presentation, and replace specific ID or class with my own content (replace all in <code>div class="message"</code>)</p>

<pre><code>&lt;div class="message"&gt;Examples here&lt;/div&gt;
</code></pre>

<p>Some website even don't use ID and class (it use table instead). So it will be better if I can replace by text (replace from start <code>&lt;table</code> to end <code>&lt;/table&gt;</code>)</p>

<pre><code>&lt;table width="890" border="0" cellpadding="0" cellspacing="0"
style="margin-top:1px;background-color:#606060;border-bottom:1px solid black"&gt;

&lt;tr style="heigh...
</code></pre>
