M87星云

导航

java 正则提取字符串中的电话号码


public static void test2() {

  String str = "张三:13539558064,李四:15626829748,赵六:13718952204";
  Pattern p = Pattern.compile("1[345678]\\d{9}");
  Matcher m = p.matcher(str);

  while(m.find()) {
    System.out.println(m.group());
  }
}

posted on 2019-12-09 11:26  挽留匆匆的美丽  阅读(2872)  评论(0编辑  收藏  举报