i am aware of the fact that backreference ovverride values if the backtraking occurs and the ovverided output will be the new backreference.
but if i take this regex for example:
([abc]+).*\1
then for the string:"abc me bca"
the output is:"abc me bca"
can someone explain how is that possible because as per the steps:
-[abc] matches a from the input.
-because their is an quantifier + so it will repeate one or more
time and again matches b and c.then stops at whitespace as it's
not either 'a', 'b' or 'c'.
-.* eats all the input string after abc and further goes
to \1(the backreference).
- .* will do backtracking as \1 fails and because .* i.e zero
or more so it will through all the charecters and again the +
of [abc]+ will do backtracking.
-in backtracking of [abc]+ it will be do until 'a' after
removing 'b' and 'c' but still their is no match for
\1 as bca.
so how the output came as "abc me bca"..?