I have a string with multiple sets of brackets, and each set of brackets contains multiple <br> tags. For instance, one snippet might read:
<p>some text<br>[text<br> text text<br>text]<br>some more text<br>[text]</p>
I need to remove the <br> tags within the brackets, but not the <br> tags outside of the brackets. I tried doing this with .replace and a .indexOf() loop, but it deleted the <br> tags outside of the brackets. Any ideas? Thanks!
You can use a regular expression and replace while it matches the
<br>in brackets: