Build, test, and debug regular expressions
Matches from the beginning of the string (first line only) and captures everything up to the last space on that line. The greedy .* backtracks to find the final space, so group 1 excludes that trailing space. The literal space is consumed but not captured. Without the m flag, ^ only anchors at the start of the string, effectively targeting just the first line.