Match Dates : Date « Regular Expressions « Java






Match Dates

 


public class Main {
  public static void main(String[] argv) throws Exception {

    boolean retval = false;
    String date = "12/12/1212";
    String datePattern = "\\d{1,2}-\\d{1,2}-\\d{4}";
    retval = date.matches(datePattern);

  }
}

   
  








Related examples in the same category