Cache regular expressions for reuse.