Add parameters to Select-String for matching all lines from (StartPattern) to (EndPattern)
To get blocks of text from a file, e.g. config sections from an opening tag to a closing line. All log lines for a reboot, starting with "System Booting at" and ending with "Boot Finished".
Select-String -Beginning '^FastEthernet' -Ending '^!'
Output: Multiple arrays of lines taken from a Cisco switch config, each array containing the lines for a FastEthernet interface configuration.
Select-String -Between '^User: .*'
Output: Arrays of lines from one "User: name" line to the next, to isolate blocks of settings for each user. Probably including the first match and excluding the second match, in the same way the range operator does:
1..5 includes the first number and excludes the second.
Reason for suggestion: People are bad at making nicely structured text output from things, and it's quite common to have needs like "I need X line and all the following lines until Y, but the number of lines can vary so I cannot use Select-String -Context".
The leading alternative is a multiline regex, which is effective but quite hard to use and read, hard to see the intended meaning.
It's entirely possible to do with a loop and a few lines of pattern matching and flag variable, but conceptually it's very close to Select-String -Context and I think would be a useful addition to Select-String's abilities.