Backtrack in Possesive Quantifier

Earlier I posted a question about regex which resulted in stackoverflow error in java. My Regex was greedy and many commented to use possessive quantifier in regex. So, I started learning Possessive quantifier in regex.

I tried to match string between double quotes. My regex is

"([^"]|.)++"

I tried to match the string

"Hello I am " chitti"

While matching there was backtracks. I tested using http://regex101.com/#PCRE. The link to regex is REGEX 101 LINK

在这里输入图像描述

Can someone please explain why there is a backtrack involved steps 6,8,10 etc


There shouldn't be a backtrack there. I would expect (and RegexBuddy shows) backtracks at the " and at the final " , but not in these positions.

RegexBuddy截图

Perhaps regex101.com displays a BACKTRACK message also when the regex engine explicitly discards a potential backtracking position, but that's only speculation on my part.

链接地址: http://www.djcxy.com/p/74774.html

上一篇: 原子团体的清晰度

下一篇: 在Possesive Quantifier中回溯