Description
In .NET10, regex (?:(?'G')|){n}(?#n > 0) always capture only once.
Reproduction Steps
using System;
using System.Text.RegularExpressions;
var input = "1";
var pattern = @"\w(?:(?'G')|){3}";
{
Console.WriteLine("--------------------interpreter---------------------");
var mh = Regex.Match(input, pattern);
foreach(Capture capture in mh.Groups["G"].Captures)
{
Console.WriteLine($"Index:{capture.Index}, Length:{capture.Length}");
}
}
{
Console.WriteLine("--------------------Compiled---------------------");
var mh = new Regex(pattern, RegexOptions.Compiled).Match(input);
foreach(Capture capture in mh.Groups["G"].Captures)
{
Console.WriteLine($"Index:{capture.Index}, Length:{capture.Length}");
}
}
Expected behavior
--------------------interpreter---------------------
Index:1, Length:0
Index:1, Length:0
Index:1, Length:0
--------------------Compiled---------------------
Index:1, Length:0
Index:1, Length:0
Index:1, Length:0
Actual behavior
--------------------interpreter---------------------
Index:1, Length:0
--------------------Compiled---------------------
Index:1, Length:0
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Description
In .NET10, regex
(?:(?'G')|){n}(?#n > 0)always capture only once.Reproduction Steps
Expected behavior
Actual behavior
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response