Minor clean up
Add optional (enabled by default) regex cache, close #1054