Given the following text in a textarea:
Line 1 stuff.. Line 1 stuff.. Line 1 stuff.. Line 1 stuff.. Line 1 stuff..
Line 2 stuff.. Line 2 stuff.. Line 2 stuff.. Line 2 stuff.. Line 2 stuff..
I want to convert the new lines to <BR> tags, not use the simple_format <P> tags…
So I tried:
str = str.gsub("\r\n", '<br>')
Problem is this is making two <BR> tags:
<div class="message">line 1<br><br>Line 2</div>
How can make just one <BR> tag?
This will turn any number of consecutive
\rand/or\ncharacters into a single<br>.