I've created regex like this:
(((([1-9]|1[0-9]|2[0-8])[-]([1-9]|1[0-2]))|((29|30|31)[-]([13578]|1[02]))|((29|30)[-]([469]|11)))[-]([0-9][0-9][0-9][0-9]))|(29[-]2[-](([0-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)))
Everything is going fine until those dates:
29-2-2017 (it matches 9-2-2017)
31-11-2017 (it matches 1-11-2017)
They don't exist or current year is not leap. How can I achieve not to match them as correct?
Working example below: https://regex101.com/r/mjfoAH/2
EDIT
I've managed finally to edit my regex to match format I need. Here it is for next generations:
((((\b[1-9]\b|1[0-9]|2[0-8])[-]([1-9]|1[0-2]))|((29|30|31)[-]([13578]|1[02]))|((29|30)[-]([469]|11)))[-]([0-9][0-9][0-9][0-9]))|(29[-]2[-](([0-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)))
Working example: https://regex101.com/r/mjfoAH/3
P.S. About possible duplicate - posted topic is about regex for another date format. Also answer checked there as correct doesn't care about leap years. That's why I created this topic.