Open User4martin opened 10 months ago
It appears that recursion (rather than sub-call) (?R)
or (?0)` does not backtrack.
https://regex101.com/r/T2Il6J/1
(?:b[^bx]+((?R))?x+)
on `baaabaaaxx'
If it did backtrack, then IMHO it should match the whole pattern, as it does if the +
after the x+
is removed: https://regex101.com/r/uEG8kF/1
There is a mention of "recursion being atomic" here https://www.rexegg.com/regex-recursion.html
Actually, changing the regex a bit ^(?'A'(?:b[^bx]+(?&A)?x+))
https://regex101.com/r/wwuP8H/1
+
of the x+
I would suggest to keep that as a reminder for an optional feature.
Martin, I am out of code knowledge here. so do the change as you wish. please test it.
If it is ok, for now just keep the issue open. Needs more research how different engines handle it, and if there is documentation. Then maybe a property controlled behaviour: current or as pcre7.3.
Solving this, would need changes that would also remove the 20 levels of recursion.
I don't plan any immediate work on it... But might later go for it.
https://regex101.com/r/g3pDSW/1
TRegExpr fails to match, because it does not backtrack the sub-call.