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.
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.
上一篇: 原子团体的清晰度