正则表达式匹配不确定重复

从一堆手机号码中,找出xyz可不连续且重复3次的手机号码

package test;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    public static Pattern pattern=Pattern.compile("(\\d{3})(.*\\1){2}");

    public static void main(String[] args) {
        String s1="13620446688";
        Matcher m1=pattern.matcher(s1);
        System.out.println(m1.find());

        String s2="13613613600";
        Matcher m2=pattern.matcher(s2);
        System.out.println(m2.find());

        String s3="13601360136";
        Matcher m3=pattern.matcher(s3);
        System.out.println(m3.find());
    }

}

\1表示重复第一个括号里的内容

相关文章

正则替换html代码中img标签的src值在开发富文本信息在移动端...
正则表达式
AWK是一种处理文本文件的语言,是一个强大的文件分析工具。它...
正则表达式是特殊的字符序列,利用事先定义好的特定字符以及...
Python界一名小学生,热心分享编程学习。
收集整理每周优质开发者内容,包括、、等方面。每周五定期发...