in reply to How to know that a regexp matched, and get its capture groups?

Parsers can be tricky. You may be interested in looking at a parsing tool such as Marpa::R2 to do most of the heavy lifting for you so that you can concentrate on syntax and output from the parser.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond