title: Why does my regex do this?
body: <p>Consider the following text: </p>
  
  <pre><code>foo:·····¶
  ·bar x··¶
  ·lorem ipsum····¶
  dolorsitamet···¶
  ···¶   
  consectetur adipiscing elit:
  </code></pre>
  
  <p>Where middle dots indicate spaces and <code>¶</code> indicates a newline. </p>
  
  <p>The regex <code>(?:foo:\s*)(.+)(?:\n\s*)</code> matches the three spaces on the whitespace line, but the regex <code>(?:foo:\s*)(.+)(?:\n\s+)</code> matches up to and not including the newline following <code>dolorsitamet</code>. Why does the * character not behave greedily? One would expect the third group <code>(?:\n\s*)</code> to match</p>
  
  <pre><code>¶
  ···¶`
  </code></pre>
  
  <p>My regex mode is multiline, dotall.</p>