This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
On the sun's tutorail on regular expression i read that greedy quantifers will first look for the whole source/input string. if a match is not found , it starts from right. so applying the same concept here if we consider the whole string "aba" clearly there is no match. so now we start from the right , there will be a match at the 2 index. but the actual output of the program is as follows:
I found the text "a" starting at index 0 and ending at index 1
I found the text "" starting at index 1 and ending at index 1.
I found the text "a" starting at index 2 and ending at index 3
I found the text "" starting at index 3 and ending at index 3.
If it is a greed quantifier and as the sun's tutorail as well as KB book points(please refer page 497) that it works the way from right/backwards shouldnt starting character must be found at index 2.
I'm very confused between the working of greedy .kindly help