I want use a RegularExpressionValidator
for a date in this form yyyy-mm-dd (example: 2012-11-29) and here is my expresion:
/^(19[789]\d|20[0123]\d)-(0\d|1[012]|\d)-(31|30|[012]\d|\d)$/
I test it on http://www.quanetic.com/Regex and it works but if I do this in my asp.net application it doesn't work
<tr>
<td>Gültig ab:</td>
<td><asp:TextBox ID="txtVon" runat="server" ></asp:TextBox></td>
<td><asp:ImageButton ID="imgVon" runat="server" ImageUrl="images/Calender.ico" Width="15" Height="15" />
<asp:CalendarExtender runat="server" ID="E_Von" TargetControlID="txtVon" Format="yyyy-MM-dd" PopupButtonID="imgVon"/></td>
<td>
<asp:RequiredFieldValidator ID="ValVon"
runat="server" ForeColor="red"
ErrorMessage="*" ControlToValidate="txtVon"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regVon"
runat="server" ControlToValidate="txtVon"
ErrorMessage="*Format" ForeColor="red"
ValidationExpression="/^(19[789]\d|20[0123]\d)\-(0\d|1[012]|\d)\-(31|30|[012]\d|\d)$/"></asp:RegularExpressionValidator>
</td>
</tr>
Where is the error?