62,625
社区成员
发帖
与我相关
我的任务
分享public static void main(String[] args) {
String str = "12345678";
String regex ="123";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(str);
System.out.println(m.find());
String str2 = "12345678";
String regex2 ="12345678";
Pattern p2 = Pattern.compile(regex2);
Matcher m2 = p2.matcher(str2);
System.out.println(m2.matches());//全匹配
}