The story behind this is interesting, this piece of code (and a few others like it) used to be in a class that has a singleton lifestyle. At some point, it was refactored into a command class that is created often, which obviously had… drastic effect on the system performance.

still odd though, as creating a regex will always pull a cached instance into itself which does the actual work. You have a little bit of overhead from looking up the instance and the key construction (check the ctor) but it's not recompiled over and over again. So that it has drastic performance improvements is a little unexpected.

MS actually recommend to use the static methods on Regex in most cased since it'll be cached automatically. I've always found it more intuitive to do the caching myself hence turn it into a static field.