title: Regex select several lines until two consecutive new lines not working on Mac
body: <p>I need to extract several lines of text (which vary in length along the 500 mb document) between a line that starts with Query # and two consecutive carriage returns. This is being done in a Mac. For example de document format is:</p>
  <pre><code>Query #1: 020.1-Bni_its1_2019_envio1set1 
  
  lines I need to extract
  
  
  Alignments (the following lines I don't need)
  
  xyz
  xyx
  
  Query #2: This and the following lines I need. And so on.
  </code></pre>
  <p>There are always exactly two carriage returns before the word &quot;Alignments&quot;. So basically I need all the lines from Query #.: until Alignments.</p>
  <p>I tried the following regex but I only recover the first line.</p>
  <pre><code>ggrep -P 'Query #.*?(?:[\r\n]{2}|\Z)' 
  </code></pre>
  <p>I have tested the regex with multiple iterations here <a href="https://regex101.com/r/TWxecV/1" rel="nofollow noreferrer">regex101</a>, but have not yet found the answer.</p>
  <p>The expected output is:</p>
  <pre><code>Query #1.   Text.
  
  Lines I need to extract
  
  Query #2: This and following lines I need.
  
  Lines I need.
  
  Query #....
  </code></pre>
  <p>thanks in advance for any pointers.</p>