You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
It's not that it's backtracking into an atomic group; it's that the (?>a*)a is erroneously being reduced to (?>a*). We need to not apply loop concatenations to atomic groups.
ghost added
in-prThere is an active PR which will close this issue when it is merged
Activity
stephentoub commentedon Aug 28, 2022
It's not that it's backtracking into an atomic group; it's that the
(?>a*)ais erroneously being reduced to(?>a*). We need to not apply loop concatenations to atomic groups.Mankarse commentedon Aug 29, 2022
It's awesome to see this get fixed so fast. Thankyou.