Inject regex matches into environment

Injecting the matches allows handlers to use the matched strings in
their logic (e.g. to lookup data by an ID).