Javascript - Global replace string between tags
<p>Could someone please help me with the regexp javascript code to replace all <code>&lt;br /&gt;</code> tags with a newline "\n" character found within <code>&lt;pre&gt;</code> divisions.. For example, a <strong>string</strong> passed to the function containing the following:</p>

<pre><code>&lt;pre class="exampleclass"&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;/pre&gt;
</code></pre>

<p>Should be returned as (newlines not shown, though I hope you get the idea):</p>

<pre><code>&lt;pre class="exampleclass"&gt;1(newline)2(newline)3&lt;/pre&gt;
</code></pre>

<p>Another example:</p>

<pre><code>&lt;div&gt;foo&lt;br /&gt;bar&lt;pre&gt;1&lt;br /&gt;2&lt;/pre&gt;&lt;/div&gt;
</code></pre>

<p>Returned as:</p>

<pre><code>&lt;div&gt;foo&lt;br /&gt;bar&lt;pre&gt;1(newline)2&lt;/pre&gt;&lt;/div&gt;
</code></pre>

<p>Note that the class and division content is dynamic, along with other content in the string (other divs etc). On the other hand, the <code>&lt;br /&gt;</code> tag does not change, so there's no need to cater for <code>&lt;br&gt;</code> or other variants.</p>

<p>NB - I'm working with strings, not HTML elements.. Just in case there is any confusion by the way I have presented the question.</p>
