title: Regex to match everything between hash tags, multiline (PHP)
body: <p>I'm trying to make a wiki markdown style parser where I have headers defined by hashtags. E.g:</p>
  
  <pre><code># Heading 1
  
  Some information here below the heading
  
  Another paragraph of information
  
  ## Subheading 1
  
  Paragraph related to the subheading
  </code></pre>
  
  <p>What I'm trying to do is capturing everything between one hash tag and another hashtag (as well as the hash tags themselves)</p>
  
  <p>So in the above, I would want to capture</p>
  
  <pre><code> Heading 1 (and #)
  
   Some information here below the heading
  
   Another paragraph of information
  </code></pre>
  
  <p>And...</p>
  
  <pre><code> Subheading 1 (and ##)
  
   Paragraph related to the subheading
  </code></pre>
  
  <p>So far I have <code>/(#+) ?(.+)/</code> and that works perfectly for content on the same line after a hash tag, but not for any text separated by newlines.</p>
  
  <p>However, I can't seem to match and newlines in the <code>(.+)</code> part of the regex pattern, without also gobbling up all of the new lines that start with hash tags.</p>
  
  <p>I'm sure it's something simple.</p>