Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1541,10 +1541,6 @@ private static bool CanBeMadeAtomic(RegexNode node, RegexNode subsequent, uint m
case Onelazy when subsequent.M > 0 && !RegexCharClass.CharInClass(subsequent.Ch, node.Str!):
case Oneloop when subsequent.M > 0 && !RegexCharClass.CharInClass(subsequent.Ch, node.Str!):
case Oneloopatomic when subsequent.M > 0 && !RegexCharClass.CharInClass(subsequent.Ch, node.Str!):
case Notone when RegexCharClass.CharInClass(subsequent.Ch, node.Str!):
case Notonelazy when subsequent.M > 0 && RegexCharClass.CharInClass(subsequent.Ch, node.Str!):
case Notoneloop when subsequent.M > 0 && RegexCharClass.CharInClass(subsequent.Ch, node.Str!):
case Notoneloopatomic when subsequent.M > 0 && RegexCharClass.CharInClass(subsequent.Ch, node.Str!):
case Multi when !RegexCharClass.CharInClass(subsequent.Str![0], node.Str!):
case Set when !RegexCharClass.MayOverlap(node.Str!, subsequent.Str!):
case Setlazy when subsequent.M > 0 && !RegexCharClass.MayOverlap(node.Str!, subsequent.Str!):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,8 @@ public static IEnumerable<object[]> Groups_Basic_TestData()
yield return new object[] { null, @"(?:a{2}?){3}?", "aaaaaaaaa", RegexOptions.None, new string[] { "aaaaaa" } };
yield return new object[] { null, @"(?:(?:[ab]c[de]f){3}){2}", "acdfbcdfacefbcefbcefbcdfacdef", RegexOptions.None, new string[] { "acdfbcdfacefbcefbcefbcdf" } };
yield return new object[] { null, @"(?:(?:[ab]c[de]f){3}hello){2}", "aaaaaacdfbcdfacefhellobcefbcefbcdfhellooooo", RegexOptions.None, new string[] { "acdfbcdfacefhellobcefbcefbcdfhello" } };
yield return new object[] { null, @"CN=(.*[^,]+).*", "CN=localhost", RegexOptions.Singleline, new string[] { "CN=localhost", "localhost" } };

// Nested atomic
yield return new object[] { null, @"(?>abc[def]gh(i*))", "123abceghiii456", RegexOptions.None, new string[] { "abceghiii", "iii" } };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ public void PatternsReduceIdentically(string pattern1, string pattern2)
[InlineData("a*a*?", "a*")]
[InlineData("a*?a*", "a*")]
[InlineData("a*[^a]*", "a*")]
[InlineData("[ab]*[^a]", "(?>[ab]*)[^a]")]
[InlineData("[ab]*[^a]*", "(?>[ab]*)[^a]*")]
[InlineData("[ab]*[^a]*?", "(?>[ab]*)[^a]*?")]
[InlineData("[ab]*(?>[^a]*)", "(?>[ab]*)(?>[^a]*)")]
[InlineData("[^a]*a*", "a*")]
[InlineData("a{2147483646}a", "a{2147483647}")]
[InlineData("a{2147483647}a", "a{2147483647}")]
Expand Down