Rollback to Possesive Quantifier

Earlier, I posted a regular expression question that resulted in a stackoverflow error in java. My Regex was greedy, and many commented on the use of possessive quantifier in regular expression. So, I began to study the Possessive quantum in regular expression.

I tried matching string between double quotes. My regex

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

I tried matching string

"Hello I am \" chitti"

If there was a coincidence, there were return routes. I tested using http://regex101.com/#PCRE . Link to a regular expression REGEX 101 LINK

enter image description here

Can someone explain why there is a return trip, steps 6,8,10 are involved, etc.

+4
source share
1

. ( RegexBuddy) backtracks \" ", .

RegexBuddy screenshot

, regex101.com BACKTRACK , regex , .

+3

Source: https://habr.com/ru/post/1528037/


All Articles