0
我希望能夠完成此操作,但接受任何格式:01/01/2001或01-01-2001或01-01-2001。有任何想法嗎?在任何日期格式的文本框中使用正則表達式
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack = "true" CausesValidation = "true"> </asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate = "TextBox1"
ValidationExpression = "^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$"// anyway i can add or here with other regex requirements
runat="server" ErrorMessage="Invalid Date format. Valid Date Format see above">
</asp:RegularExpressionValidator>
你想要什麼格式的日期是?你想接受任何日期格式或只是一個特定的格式? – mwilson 2014-11-01 22:59:17