Programming, Regular Expression

Crazy Regular Expression for Date Validation

crazy-regular-expression-test-1

Using Regex to check whether a string is a valid date format or not

/^(?:(?:[0-9]+-(?:(?:(?:0*(?:[13578]|(?:1[02])))-(?:0*(?:[1-9]|(?:[12][0-9])|(?:3[01]))))|(?:0*(?:[469]|(?:11))-(?:0*(?:[1-9]|(?:[12][0-9])|(?:30))))|(?:0*2-(?:0*(?:[1-9]|(?:1[0-9])|(?:2[0-8]))))))|(?:(?:(?:0*[048])|(?:[0-9]*(?:(?:0[48])|(?:[13579][26])|(?:[2468][048])))|(?:[0-9]*(?:(?:[48])|(?:[13579][26])|(?:[02468][048]))(?:00)))-(?:(?:(?:0*(?:[13578]|(?:1[02])))-(?:0*(?:[1-9]|(?:[12][0-9])|(?:3[01]))))|(?:0*(?:[469]|(?:11))-(?:0*(?:[1-9]|(?:[12][0-9])|(?:30))))|(?:0*2-(?:0*(?:[1-9]|(?:[12][0-9])))))))$/

512 characters