title: Powershell advanced regex to select from file
body: <p>I would like to search for a pattern in a file which I can do easily with something like:</p>
  
  <pre>
  gc $filename | select-string $pattern
  </pre>
  
  <p>However once I have found this first pattern, using the location (line) of the first match as a starting point I would then like to start searching for a second pattern. Once the second pattern has been matched I would then like to return all lines between the first and second matches, discarding the matched lines themselves. </p>