From b7ba4e6f15104f6ad87461079f84741974078718 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Wed, 15 Jul 2020 23:29:01 -0700 Subject: [PATCH 1/4] Unit test --- .../System.Text.RegularExpressions/tests/Regex.Match.Tests.cs | 2 ++ 1 file changed, 2 insertions(+) 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') From c5b1ac821c180f69d29d880681d30355f82bb541 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Wed, 15 Jul 2020 23:32:12 -0700 Subject: [PATCH 2/4] Fix --- .../src/System/Text/RegularExpressions/RegexCompiler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); } From 9855bfb78cf9ddf2567e74b0668067ed971e44b3 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Thu, 16 Jul 2020 01:02:03 -0700 Subject: [PATCH 3/4] Typo --- .../System.Text.RegularExpressions/tests/Regex.Match.Tests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 aec0b8ccd8e22b..70dfee3c47d9f3 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs @@ -16,7 +16,7 @@ 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#" }; + 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') From 29435422cc344dc4321ea933542c4acacb736b30 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Thu, 16 Jul 2020 07:36:15 -0700 Subject: [PATCH 4/4] CR feedback --- .../src/System/Text/RegularExpressions/RegexCompiler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2733536bdbd57a..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,7 +1335,6 @@ protected void GenerateFindFirstChar() } // ch = runtext[runtextpos]; - // if (ch == lastChar) goto partialMatch; Rightchar(); if (_boyerMoorePrefix.CaseInsensitive) { @@ -1349,6 +1348,7 @@ protected void GenerateFindFirstChar() Ldloc(chLocal); Ldc(chLast); + // if (ch == lastChar) goto partialMatch; BeqFar(lPartialMatch); // ch -= lowAscii;