title: Remove empty lines from string, but allow one empty between every line
body: <p>I would like to remove excessive empty lines from a string, but allow one empty line between every line. Like:</p>
  
  <pre><code>line1
  
  
  
  
  
  line2
  </code></pre>
  
  <p>Should become:</p>
  
  <pre><code>line1
  
  line2
  </code></pre>
  
  <p>I did find the following regex (forgot where i found it):</p>
  
  <pre><code>preg_replace('/^\n+|^[\t\s]*\n+/m','',$message);
  </code></pre>
  
  <p>This works, but removes all empty lines without leaving an empty line between every line.</p>
  
  <p>Edit: I just created a quick example at <a href="http://jsfiddle.net/RAqSS/" rel="nofollow noreferrer">http://jsfiddle.net/RAqSS/</a></p>