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..2733536bdbd57a 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 @@ -1337,7 +1337,7 @@ protected void GenerateFindFirstChar() // ch = runtext[runtextpos]; // if (ch == lastChar) goto partialMatch; Rightchar(); - if (_boyerMoorePrefix.CaseInsensitive && ParticipatesInCaseConversion(chLast)) + if (_boyerMoorePrefix.CaseInsensitive) { CallToLower(); } 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..aec0b8ccd8e22b 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, 1, 2, true, "H#" }; // Testing octal sequence matches: "\\060(\\061)?\\061" // Octal \061 is ASCII 49 ('1')