MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

public class MainClass {
    public static void main(String args[]) {

        String date = "12-12-1212";

        String datePattern = "\\d{1,2}-\\d{1,2}-\\d{4}";
        System.out.println(date.matches(datePattern));

    }
}