in reply to Storing pattern matches

In that case you are halfway there.