/*. {3 }(? = A) represents a function like this: * Find a substring that matches the first three letters of A in the given string. Of course, the obtained substring does not include (? = A) */pattern P = pattern. Compile (". {3 }(? = )");//(? = X) x, through the zero-width positive lookahead string S1 = "444a66b"; matcher M = P. matcher (S1); While (M. find () {P (M. group ());} P ("***********************************"); /* Similarly \ D {3 }(? = A) indicates a function like this: * search for a substring that matches the first three digits of a. Of course, the obtained substring does not include (? = A) * The 444a66b in this example is matched, and the resulting group is 444 * and "44d4a66b"; it does not match, because there are no consecutive three numbers before a * In example. {3 }(? = B) if the string used to match 444a66b is A66 */P = pattern. Compile ("\ D {3 }(? = )");//(? = X) x, through the zero-width positive lookahead string S2 = "444a66b"; M = P. matcher (S2); While (M. find () {P (M. group ());} P ("***********************************"); (? = X) Let's test and imagine (?! A), the API is interpreted *(?! X) x, through the negative lookahead with Zero Width, it is easy to think of * \ D {3 }(?! A) It indicates that the character after three consecutive numbers is not a match, * therefore, the string 444a666b has only one matched substring: 666 * the string 444b666b matches both the 444 x string 444a666a */P = pattern. compile ("\ D {3 }(?! A )");//(?! X) X, with zero-width negative lookahead string S3 = "444b666b"; M = P. matcher (S3); While (M. find () {P (M. group ());}