62,614
社区成员
发帖
与我相关
我的任务
分享
Pattern pattern = Pattern.compile("1_12_._._3");
java.util.regex.Matcher matcher = pattern.matcher("1_12_0_102_3");
boolean find = matcher.find();
if(find) {
System.err.println("ok");
} else {
System.err.println("false");
}
Pattern pattern = Pattern.compile("1_12_._._3");
java.util.regex.Matcher matcher = pattern.matcher("1_12_0_1_3");
boolean find = matcher.find();
if(find) {
System.err.println("ok");
} else {
System.err.println("false");
}
这个程序我运行了一下,输出ok。Pattern pattern = Pattern.compile("1_12_\\d{1}_\\d{3}_3");
Pattern pattern = Pattern.compile("1_12_.+_.+_3");