Can someone help me with javascript regexp code to replace all tags with <br />the newline character \ "\ n" found within <pre>. For example, the lineA function passed, containing the following:
<pre class="exampleclass">1<br />2<br />3</pre>
Should be returned as (new lines not shown, although I hope you understand this idea):
<pre class="exampleclass">1(newline)2(newline)3</pre>
Another example:
<div>foo<br />bar<pre>1<br />2</pre></div>
Return:
<div>foo<br />bar<pre>1(newline)2</pre></div>
Note that the contents of the class and section are dynamic, along with other contents in the line (other divs, etc.). On the other hand, the tag <br />does not change, so there is no need to service <br>or other options.
NB - I work with strings, not HTML elements. Just in case, there is some confusion as I presented the question.