Closed
Description
Description
In some scenarios, the regex engine can backtrack in an atomic group. This should not be possible
Reproduction Steps
var m = System.Text.RegularExpressions.Regex.Match("aaa", "^(?>a*)a$")
Expected behavior
m.Success == false
The above regex should not match. The atomic group should greedily match "aaa", and then be unable to backtrack to match "aa"; and so the overall match should fail.
Actual behavior
m.Success == true
The regex matches.
Regression?
Behaviour is correct on:
.NET Core 3.1.28
.NET Framework 4.8.4515.0
Behaviour is incorrect on:
.NET 5.0.17
.NET 6.0.8
.NET 7.0.0-preview.7.22375.6
(Version names from System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription)
Known Workarounds
No response
Configuration
Bug exists on
.NET 5.0.17
.NET 6.0.8
.NET 7.0.0-preview.7.22375.6
Windows 10 21H2
x64
Other information
No response