### Description non-backtracking regex fails to match on newline alternate with preceding alternate being any 254 length string of distinct characters ### Reproduction Steps ```c# using System; using System.Linq; using System.Text.RegularExpressions; var p = string.Concat(Enumerable.Range(0x4E00, 254).Select(c => (char)c)) + "|\\n"; Console.WriteLine(new Regex(p, RegexOptions.NonBacktracking).IsMatch("\n")); ``` ### Expected behavior prints `true` ### Actual behavior prints `false` even though `\n` is obviously a valid alternate ### Regression? IDK ### Known Workarounds None ### Configuration .NET 10.0.12 macOS 27.0 ARM64 ### Other information ```c# using System; using System.Linq; using System.Text.RegularExpressions; var p = string.Concat(Enumerable.Range(0x4E00, 253).Select(c => (char)c)) + "|\\n"; Console.WriteLine(new Regex(p, RegexOptions.NonBacktracking).IsMatch("\n")); ``` if the range is shrunk to 253 it works
Activity
dotnet-policy-service commentedon Oct 7, 2026
Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions
See info in area-owners.md if you want to be subscribed.
MihaZupan commentedon Oct 7, 2026
Possibly fixed by #120622
MihaZupan commentedon Oct 19, 2026
I'll close this as fixed, feel free to comment again if you see otherwise