Aside: Ok, I know I shouldn’t be picking apart HTML like this with a regex, but its the simplest for what I need.
I have this regex:
Regex BodyEndTagRegex = new Regex("</body>(.*)$", RegexOptions.Compiled |
RegexOptions.IgnoreCase | RegexOptions.Multiline);
Notice how I’m looking for the end of the string with $.
Are .NET’s regular expressions optimized so that it doesn’t have to scan the entire string? If not, how can I optimize it to start at the end?
You can control it itself by specifying Right-to-Left Mode option, but regex engine does not optimize it itself automatically until you do it yourself by specifying an option:
I believe key point is:
Important: