@@ -0,0 +1,539 @@
+package com.zzm.segmentfault.question;%0A%0Aimport java.util.regex.Matcher;%0Aimport java.util.regex.Pattern;%0A%0Apublic class Q1010000002719930 %7B%0A    public static void main(String%5B%5D args) %7B%0A        matchDateString(%222015-4-30%22);%0A        matchDateString(%222015-04-30%22);%0A        matchDateString(%222015-02-20%22);%0A    %7D%0A%0A    private static void matchDateString(String string) %7B%0A        Pattern pattern = Pattern.compile(%22(%5C%5Cd)%7B4%7D-(%5C%5Cd)%7B2%7D-(%5C%5Cd)%7B2%7D%22);%0A        Matcher matcher = pattern.matcher(string);%0A        System.out.println(matcher.find());%0A    %7D%0A%7D%0A

add new answer