Cache regular expression objects in lexer