For the format dd/mm/yyyy
^(?:(?:[12][0-9]|0?[1-9])/0?2|(?:30|[12][0-9]|0?[1-9])/(?:0?[469]|11)|(?:3[01]|[12][0-9]|0?[1-9])/(?:0?[13578]|1[02]))/[0-9]{4}$
The only problem with this regex is, that it will match the 29th of february of every year.
This regular expression consists of:
(?:[12][0-9]|0?[1-9])/0?2
This part trys to match the correct day and month if the month is february. (From 1st to 29th of february)
If the month is not february try to match:
(?:30|[12][0-9]|0?[1-9])/(?:0?[469]|11)
This part trys to match every month that has 30 days. (it's the month 4,6,9 and 11) (From 1st to 30th day of month).
If the month also is not April, June, September, or November
(?:3[01]|[12][0-9]|0?[1-9])/(?:0?[13578]|1[02])
This part trys to match the month (1, 3, 5, 7, 8, 10 and 12)
The last part: [0-9]{4}
matches the year. (Every 4-digit number)
If you want the regex to match only till 28th of february use:
^(?:(?:1[0-9]|2[0-8]|0?[1-9])/0?2|(?:30|[12][0-9]|0?[1-9])/(?:0?[469]|11)|(?:3[01]|[12][0-9]|0?[1-9])/(?:0?[13578]|1[02]))/[0-9]{4}$
If you want the regex to match only till 28th of february dd/mm/yyyy with required leading zero if lower than 2 digits: (you just have to replace all 0? with 0)
^(?:(?:1[0-9]|2[0-8]|0[1-9])/02|(?:30|[12][0-9]|0[1-9])/(?:0[469]|11)|(?:3[01]|[12][0-9]|0[1-9])/(?:0[13578]|1[02]))/[0-9]{4}$