The regular expression specifies the number of delimiters, Such ?, +, *, {N, m} matches the greedy mode by default, for example,. * The result of B matching acbab is that acbab instead of acb Regular Expressions support the lazy mode, that is, a quantity modifier (quantifier) is added after the number limit, which is represented by a question mark, for example:. *? B matches acbab instead of acbab www.2cto.com. Java supports a Possessive quantity modifier in regular expressions, which is expressed by a plus sign. It literally means matching like greedy mode, but not backtracking. What does this mean? In fact, this is related to the matching algorithm. For example, in greedy mode, the regular expression. * When B matches acbac, after the first character a is successfully matched, the matching algorithm will continue to read the characters After character a for matching. * In this case, the greedy mode works, and the cbac behind a can match. * But when the matching algorithm continues to read characters later, it finds that no characters are readable and cannot match B in the regular expression, so it goes back to a character to see if c can match B, no. Continue tracing until it is traced back to B. A. * + B does not trace back when matching. That is to say, when greedy reading the last character and finding that no character matches B, the matching fails. Here are a few examples (AB) * + a can match ababacd. Because the two AB S do not have AB, they cannot greedy? + A matches aaaaa with aa, but a ++ a and a {0, 10} + a fail to match.