The Sections (Sections selection) parameter provides a way to select one or more sections (subsets) of the code to be shown. This makes it possible to focus the user's attention to specific sections of code and ignore superfluous lines. Powerful regular expression (regex) based selection can used to precisely control the selection.
Using capture groups to pinpoint lines
By using capture groups in the regex, the exact lines to include can be specified. Normally, line identifiers are inclusive. This means that the line that matches the regex are included in the subset of lines. However, by constructing a regex with a capture group, a more precise location can be identified.
- For regex used for a range value, the first capture group pinpoints the line number to be used.
- For a single regex, the first capture group identifies the start line and the second capture group identifies the final selected line.
Note that \n can be used to identify the line end character no matter what the original source has for line ends. Selection logic is consistent since all code is normalized to the Unix-style line ends.