title: Replace multiple blank lines in text using Javascript
body: <p>Hopefully a simple question.</p>
  
  <p>If I have text like this:</p>
  
  <pre><code>Orange
  Apples
  
  
  Melons
  
  Bananas
  </code></pre>
  
  <p>...how can I replace all occurrences of <em>multiple</em> blank lines with single blank lines, ending up with this:</p>
  
  <pre><code>Orange
  Apples
  
  Melons
  
  Bananas
  </code></pre>
  
  <p>Fiddle: <a href="http://jsfiddle.net/Jq4pT/" rel="nofollow noreferrer">http://jsfiddle.net/Jq4pT/</a>
  Need to remove multiple blank lines from the first box's input before inserting into the second.</p>
  
  <p>I've found <a href="https://stackoverflow.com/a/4475642">this link</a>, but am not sure how to use that regular expression in Javascript?</p>
  
  <p>Thanks.</p>