I want to convert this string:
Lorem ipsum dolor sit amet.\n\nConsectetur adipiscing elit.\n\nNunc eros enim.
into HTML tags:
<p>Lorem ipsum dolor sit amet.</p><p>Consectetur adipiscing elit.</p><p>Nunc eros enim.</p>
Want to keep strings without double line breaks unchanged. Single line breaks should be ignored. There are no line breaks at the end nor beging of the string.
I am using javascript String.Replace() method.
I have tried this:
"one\n\ntwo".replace(/(.*)\n\n(.*)/, "<p>$1</p><p>$2</p>")
However this works only with exactly two paragraphs.