diff --git a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs index b26a627a8cf2e9..bd5bf8a60e67c7 100644 --- a/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs +++ b/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs @@ -1335,9 +1335,8 @@ protected void GenerateFindFirstChar() } // ch = runtext[runtextpos]; - // if (ch == lastChar) goto partialMatch; Rightchar(); - if (_boyerMoorePrefix.CaseInsensitive && ParticipatesInCaseConversion(chLast)) + if (_boyerMoorePrefix.CaseInsensitive) { CallToLower(); } @@ -1349,6 +1348,7 @@ protected void GenerateFindFirstChar() Ldloc(chLocal); Ldc(chLast); + // if (ch == lastChar) goto partialMatch; BeqFar(lPartialMatch); // ch -= lowAscii; diff --git a/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs b/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs index 9ae78f8f91d2bb..70dfee3c47d9f3 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs @@ -15,6 +15,8 @@ public class RegexMatchTests public static IEnumerable Match_Basic_TestData() { // pattern, input, options, beginning, length, expectedSuccess, expectedValue + yield return new object[] { @"H#", "#H#", RegexOptions.IgnoreCase, 0, 3, true, "H#" }; // https://github.com/dotnet/runtime/issues/39390 + yield return new object[] { @"H#", "#H#", RegexOptions.None, 0, 3, true, "H#" }; // Testing octal sequence matches: "\\060(\\061)?\\061" // Octal \061 is ASCII 49 ('1')