I have the following form code that allows input of a date using AngularUI (date is required and should match US date format e.g.: MM/DD/YY):
The accepted answer doesn't work for me. I changed to:
^(0?[1-9]|1[012])\/(0?[1-9]|[12][0-9]|3[01])\/((19\d{2})|([2-9]\d{3}))$
Otherwise only people born after 1990 need apply!
Your ng-pattern worked in a fiddle I created, but it allows for some incorrect dates, such as 0/9/1993 and 19/2/1993.
Here's a better pattern: (note, it was updated to match @WillSadler's answer)
^(0?[1-9]|1[012])\/(0?[1-9]|[12][0-9]|3[01])\/((19\d{2})|([2-9]\d{3}))$
Fiddle.
Check with leap year validate: Date format:dd-mm-yyyy
Regex pattern: ^(0?[1-9]|1\d|2[0-8]|29(?=[-]\d?\d[-](?!1[01345789]00|2[1235679]00)\d\d(?:[02468][048]|[13579][26]))|30(?![-]0?2)|31(?=[-]0?[13578]|[-]1[02]))[-](0?[1-9]|1[0-2])[-]([12]\d{3})$
Demo
another demo