When you are after the implementation details, and when the source code is available, the best way to say it is to just look at it. :)
Short answer: not really.
The optimization implemented in the implementation of the .NET regular expression is the Boyer-Moore search string as the first matching phase whenever possible . Take a look at the source code for gory details.
From the code itself:
This requires the binding of a prefix , the search for which is carried out by this function , the comment of which indicates:
The matching algorithm contains code that immediately returns the result without matching if the input string is shorter than the computed prefix.
Note that he is also looking for bindings and optimizations for them, of course.
I did not find the minimum length optimization in the code, but I admit that I have not read it completely (I have to do it one day) . But I know other regular expression implementations that do this kind of optimization (PCRE comes to mind). Anyway, the .NET implementation has its own way of optimizing things, you should rely on it.
Lucas trzesniewski
source share