Regex to validate dates in this format d/m/yyyy -
i found regex works wonders,but forces leading 0's on month , day , need accept dates have month and/or day in single digit format
i tested regex tester:
^(((0?[1-9]|[12]\d|3[01])\/(0?[13578]|1[02])\/((1[6-9]|[2-9]\d)\d{2}))|((0?[1-9]|[12]\d|30)\/(0?[13456789]|1[012])\/((1[6-9]|[2-9]\d)\d{2}))|((0?[1-9]|1\d|2[0-8])\/0?2\/((1[6-9]|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0?[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$
this same @ant18 linked, added ?
every leading 0
.
edit: sry misread asker's name, corrected
Comments
Post a Comment