Implementing submatches is a common need, and Ragel makes it pretty easy.
Let's take just the first line. This creates a ragel machine named clf_year that will parse four digits optionally preceded by a minus sign.
Ragel supports numerous state machine actions for each machine. One of the most common actions is the entering action, which is called when the machine is entered.
When the clf_year machine is entered, the action tag_clf_year is called.