Javascript: replace all instances of <br> that appear between multiple sets of brackets
<p>I have a string with multiple sets of brackets, and each set of brackets contains multiple <code>&lt;br&gt;</code> tags. For instance, one snippet might read:</p>

<pre><code>&lt;p&gt;some text&lt;br&gt;[text&lt;br&gt; text text&lt;br&gt;text]&lt;br&gt;some more text&lt;br&gt;[text]&lt;/p&gt;
</code></pre>

<p>I need to remove the <code>&lt;br&gt;</code> tags within the brackets, but not the <code>&lt;br&gt;</code> tags outside of the brackets.  I tried doing this with .replace and a .indexOf() loop, but it deleted the <code>&lt;br&gt;</code> tags outside of the brackets.  Any ideas?  Thanks!</p>
