Enable regex to use IndexOf(..., OrdinalIgnoreCase) for prefix searching (#85438)
authorStephen Toub <stoub@microsoft.com>
Mon, 1 May 2023 16:56:20 +0000 (12:56 -0400)
committerGitHub <noreply@github.com>
Mon, 1 May 2023 16:56:20 +0000 (12:56 -0400)
commitb4ecf1092d2b75c2702c9536bb6c362534a15fa5
tree99cbdb4fb453818dc415513ac8b56a8b92a1dd07
parentad3e4b788240678a52ecc5b08e6428cd5f019c0d
Enable regex to use IndexOf(..., OrdinalIgnoreCase) for prefix searching (#85438)

As one of its many ways of finding the next possible match starting location, Regex recognizes a string known to start the expression and uses IndexOf to find it.  With this change, it can also do so for OrdinalIgnoreCase.  With improvements to IndexOf(..., OrdinalIgnoreCase), this now yields significantly faster searches through longer inputs, in addition to leading to simpler code in source generated regexes.
src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexFindOptimizations.cs
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexPrefixAnalyzer.cs