title: Regex match first group with certain text
body: <p>I'm trying to match blocks of text that contain certain text within them. Each block is clearly defined by standard start/end text patterns. </p>
  
  <p>In the below example I want to match steps 1 and 3 from the "step start" to "step end" as they contain the text "database:dev". However my current regex matches step 1 fine, but then matches steps 2 and 3 in a single match. It's probably easier to see with an example here: <a href="https://regex101.com/r/56tfOQ/3/" rel="nofollow noreferrer">https://regex101.com/r/56tfOQ/3/</a></p>
  
  <p>I need to specify that each match can only contain one "step start", but I can't work out how to do that.</p>
  
  <p>The regex I'm currently using is: </p>
  
  <pre><code>(?msi)step start.*?database:dev.*?step end
  </code></pre>
  
  <p>An example of the text is:</p>
  
  <pre><code>step start
      name:step1
      database:dev1
  step end
  step start
      name:step2
      database:test1
  step end
  step start
      name:step3
      database:dev2
  step end
  step start
      name:step4
      database:test2
  step end
  </code></pre>