分组
用()进行分组,每个分组从1开始编号,要再次使用分组匹配后的结果,用\\
String regex2 = "(.)\\1(.)\\2";
String regex2 = ".{2}.{2}";//".."
System.out.println("高高高兴兴".matches(regex2));
String regex3 = "(..)\\1";
System.out.println("高兴高兴".matches(regex3));
//邮箱:hjx2006@163.com.com.com.com.com.com.com.com
//\\w+@\\w+(\\.\\w+)+
//\\w+@\\w+(\\.\\w+)\\1+
|
|