title: Matching blank lines with regular expressions
body: <p>I've got a string that I'm trying to split into chunks based on blank lines.</p>
  
  <p>Given a string <code>s</code>, I thought I could do this:</p>
  
  <pre><code>re.split('(?m)^\s*$', s)
  </code></pre>
  
  <p>This works in some cases:</p>
  
  <pre><code>&gt;&gt;&gt; s = 'foo\nbar\n \nbaz'
  &gt;&gt;&gt; re.split('(?m)^\s*$', s)
  ['foo\nbar\n', '\nbaz']
  </code></pre>
  
  <p>But it doesn't work if the line is completely empty:</p>
  
  <pre><code>&gt;&gt;&gt; s = 'foo\nbar\n\nbaz'
  &gt;&gt;&gt; re.split('(?m)^\s*$', s)
  ['foo\nbar\n\nbaz']
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>[python 2.5; no difference if I compile <code>'^\s*$'</code> with <code>re.MULTILINE</code> and use the compiled expression instead]</p>