Move regex compilation code into tokens file