I know such questions are in ton and it feels like a dupe question. As I haven’t found the solution closed to me, thats why i am posting this. I have a regex in my regular exp validator
<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="Invalid date format. Valid dates are 12/31/2009 (mm/dd/yyyy). " ControlToValidate="txtDOB" Display="None" EnableTheming="False" EnableViewState="False" SetFocusOnError="True" ValidationGroup="grpUser"
ValidationExpression="^(?=\d)(?:(?:31(?!.(?:0?[2469]|11))|(?:30|29)(?!.0?2)|29(?=.0?2.(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(?:\x20|$))|(?:2[0-8]|1\d|0?[1-9]))([-./])(?:1[012]|0?[1-9])\1(?:1[6-9]|[2-9]\d)?\d\d(?:(?=\x20\d)\x20|$))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\x20[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$"></asp:RegularExpressionValidator>
Its failing to validate the date in mm/dd/yyyy or m/d/yyyy format. I have taken this from RegexLib where the author said its valid for both formats. Are the ^ and $ creating issues. Please help.
Unless you have a good reason to do otherwise, you should use a
CompareValidator