title: Regex that stop at a line
body: <p>I'm trying to build a regex that stop when a line is equal to &quot;--- admonition&quot;.</p>
  <p>For example, I have :</p>
  <pre><code>??? ad-question Quels sont les deux types de bornages ?
  
  Il y en a deux :
  
  - Le bornage amiable.
  
  - Le bornage judiciaire.
  
  test
  
  --- admonition
  </code></pre>
  <p>I can have the same capture format multiple time on a page.</p>
  <p>I want to retrieve (in every match) in a first group :</p>
  <blockquote>
  <p>Quels sont les deux types de bornages ?</p>
  </blockquote>
  <p>and in a second :</p>
  <blockquote>
  <p>Il y en a deux :</p>
  <ul>
  <li><p>Le bornage amiable.</p>
  </li>
  <li><p>Le bornage judiciaire.</p>
  </li>
  </ul>
  <p>test</p>
  </blockquote>
  <p>I tried :</p>
  <pre><code>^\?{3} ad-question {1}(.+)\n*((?:\n(?:^[^#].{0,2}$|^[^#].{3}(?&lt;!---).*))+)
  </code></pre>
  <p>or</p>
  <pre><code>^\?{3} ad-question {1}(.+)\n*((?:\n(?:^[^\n#].{0,2}$|^[^\n#](?&lt;!----).*))+)
  </code></pre>
  <p>but it didn't stop at &quot;\n--- admonition&quot; and it took the new line between the two group.</p>
  <p>Is someone can help me build this regex ?</p>
  <p>ps : I must have a new line between the two group and between group 2 and &quot;---- admonition&quot;. So these lines must be avoid in the groups.</p>
  <p>Thanks for your help.</p>