Microsoft offers a method called Match that matches a Regex pattern starting at a specific position in the input string. What I am trying to do is optimize the performance of my program by using the static method version of Match, there by gaining the benefit of caching. There does not seem to be a way to specify a specific position to start matching though, even though the member version does. Is there anyway to emulate this or is there an alternate static method I’m missing that allows me to start searching for my pattern at a specific spot in the input string? Any help would be appreciated.
Microsoft offers a method called Match that matches a Regex pattern starting at a
Share
If you use a disassembler tool like DotPeek to look inside the System.dll, you’ll see that the implementation of the static function creates a new Regex object:
So in fact it’s just the opposite – the static function has worse (or at least not better) performance.