public class demo_3 {
public static void main(String[] args) {
String s = "13265477888=168,15241698745=11,13699989898=20,1898686666=120]";
String regex = "1[358]\\d{9}";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(s);
boolean b = m.matches();
while(m.find()){
System.out.println(m.group());
}
}
}
public class demo_4 {
public static void main(String[] args) {
String s = "a13265477888=168,15241698745=11,13699989898=20,1898686666=120]";
String regex = "1[358]\\d{9}";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(s);
boolean b = m.matches();
while(m.find()){
System.out.println(m.group());
}
}
}
|
-
1.png
(175.87 KB, 下载次数: 11)
首位没有字符
-
2.png
(175.2 KB, 下载次数: 10)
首位有字符
|