java正则表达式判断一个字符串包含连续数字

判断一个字符串是否包含连续数字

String reg = "^.*\\d{15}.*$";
String text = "{\"words\":\"注册号460106600543629\"";
if(text.matches(reg)&&text.contains("注册号")){
    System.out.println("包含15位连续数字,并且包含注册号");
}

猜你喜欢

转载自st4024589553.iteye.com/blog/2384576