Java正则匹配提取年月日字符串
String string1="9999-9-99";
Pattern p = Pattern.compile("(\\d{4})-(\\d{1,2})-(\\d{1,2})");
Matcher m = p.matcher(string1);
if(m.find()) {
System.out.println(m.group());
System.out.println(m.group(0));
System.out.println(m.group(1));
System.out.println(m.group(2));
System.out.println(m.group(3));
}