Conceptual

Capture Groups and Extracting Matched Text in Python

Parentheses mark the part of a match you want back, and .group(n) retrieves it. This turns a regex from a yes/no test into an extractor — the difference between knowing a line contains a date and having the year in a variable.