By default (as in example X+) Java regex quantifiers are greedy , the regex engine starts out by matching as many characters it can. We can change this default behavior by appending another metacharacter e.g. X+?.
By default (as in example X+) Java regex quantifiers are greedy , the regex engine starts out by matching as many characters it can. We can change this default behavior by appending another metacharacter e.g. X+?.