Test, validate and match regular expressions
With the multiline flag, ^ matches the start of each line, and the non-capturing group (?:.*\n){2} consumes exactly two full lines (any content plus trailing newline). This is useful for matching or skipping lines in pairs, such as joining two-line records, deleting every other line, or processing files with a fixed two-line structure.