Regex -Muster für die Datumsvalidierung

// Pattern validates that: 
// day is from 01 to 31
// month is from 01 to 12
// year must be 19yy or 20yy
// delimiter is / or - or .
// date format is dd-mm-yyyy or yyyy-mm-dd
String dateRegex =
                "((0[1-9]|[12][0-9]|3[01])" +   //dd from 01 to 31
                "[/.-]" +                       // - or . or /
                "([01][0-9])" +                 //mm from 01 to 12
                "[/.-]" +                       // - or . or /
                "(19[0-9]{2}|20[0-9]{2}))" +    //yyyy must be 19yy or 20yy

                "|" +                           //or

                "((19[0-9]{2}|20[0-9]{2})" +    //yyyy must be 19yy or 20yy
                "[/.-]" +                       // - or . or /
                "([01][0-9])" +                 //mm from 01 to 12
                "[/.-]" +                       // - or . or /
                "(0[1-9]|[12][0-9]|3[01]))";    //dd from 01 to 31