The match() method in the String class inputs abc, which can only match the string whose entire string is abc, and if there is abc in the string, it cannot be matched;
And using this method can successfully match the abc in abcd:
Pattern p = Pattern.compile("abc");
Matcher m = p.matcher("abcd");
while(m.find()){
System.out.println(m.group());//abc
}