I'am reading regular expression from the
java tutorials given on Sun's site. Please refer the link
http://docs.oracle.com/javase/tutorial/essential/regex/quant.html. Regarding greedy quantifiers it says that
Greedy quantifiers are considered "greedy" because they force the matcher to read in, or eat, the entire input
string prior to attempting the first match. If the first match attempt (the entire input string) fails, the matcher backs off the input string by one character and tries again, repeating the process until a match is found or there are no more characters left to back off from.
What does here the line "backs off the input string by one character and tries again actually means? can somebody please explain with a simple example.
Same for reluctant(although they are not on
SCJP 6). Again referring to the link above it says that "The reluctant quantifiers, however, take the opposite approach: They start at the beginning of the input string, then reluctantly eat one character at a time looking for a match. " Here also what does "eat one character at a time looking for a match means ".