All about Java String.
Subtle difference is present b/w reluctant, greedy and possessive quantifiers.
Greedy ones are known as greedy as they enforce matchers to eat or read in the whole input string before the 1st match attempt. When 1st attempt of match gets failed, input string is back offed by the matcher by 1 character and then tries once again in which the process is repeated till the match is being found or no more characters have been left for backing off. It totally depends upon quantifier that