title: Why is this p tag being added as a new line?
body: <p>The following code splits <code>data</code>, applies a regex, and joins the string again (there's a part that removes new lines between words because I want the paragraphs to be output in a single block/line):</p>
  
  <p>Input:</p>
  
  <blockquote>
    <p>Lorem ipsum dolor sit amet</p>
    
    <p>Ipsum dolor sit amet, consetetur eirmod tempor invidunt ut labore</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>data = data.split('\n\n')
  for (var i = 0; i &lt; data.length; ++i) {
    data[i] = '&lt;p&gt;' + data[i].replace(/\n(?=\w+)/g, ' ') + '&lt;/p&gt;'
  }
  data = data.join('\n\n')
  </code></pre>
  
  <p>I thought the input would be:</p>
  
  <pre><code>&lt;p&gt;Lorem ipsum dolor sit amet&lt;/p&gt;
  
  &lt;p&gt;Ipsum dolor sit amet, consetetur eirmod tempor invidunt ut labore&lt;/p&gt;
  </code></pre>
  
  <p>But no, it's instead:</p>
  
  <pre><code>&lt;p&gt;Lorem ipsum dolor sit amet&lt;/p&gt;
  
  &lt;p&gt;Ipsum dolor sit amet, consetetur eirmod tempor invidunt ut labore
  &lt;/p&gt;
  </code></pre>
  
  <p>What could be the cause?</p>