Cache the regex derivatives in the compilation state to avoid recomputing them.