Test, validate and match regular expressions
Matches the final two lines of a multi-line string, capturing the second-to-last (penultimate) line in capture group 1. Because `$` anchors to the end of the string in PCRE2, the greedy `(.*)` backtracks to the last newline, ensuring group 1 holds everything on the line immediately before the final line. Useful for extracting the penultimate line from logs or multi-line records without splitting the text.