title: Regex to match lines in-between two specific lines, in Python
body: <p>I am trying to use regex to parse out some lines from text read in from a file. I know this could be done by reading in the file, line-by-line, but I like the elegance in capturing all the relevant bits of info in a single regex match.</p>
  
  <p>The example file contents:</p>
  
  <pre><code>---
  title: a title
  layout: page
  ---
  
  here's some text
  ================
  
  this will be blog post content.
  </code></pre>
  
  <p>I am trying to produce a regex match that will return 2 groups: the data in-between the "---" lines, and all of the data after the 2nd "---" line. Here is the regex string I have come up with, and I am having an issue with it:</p>
  
  <pre><code>re.match('---\n(.*?)\n---\n(.*)', content, re.S)
  </code></pre>
  
  <p>This seems to work well, except when dealing with unix vs windows line-endings. Is there a way to allow this regex to match a \r if it's present, too? It works with the unix, which is just <code>\n</code> I believe.</p>
  
  <p>Also, if you think this regex could be improved, I'm open to suggestions.</p>