Author: nisarkhan | Posted on: 2/19/2009 7:15:33 PM | Views : 291

 i have been pounding my head on the wall......

how do you validate a date?

here is what i'm using for regex its working great but its failing when i enter "09/09/009"

here is the code:

 <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtStartDate"
                                        ValidationExpression="^((0?[13578]|10|12)(-|\/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[01]?))(-|\/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1}))|(0?[2469]|11)(-|\/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[0]?))(-|\/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1})))$"
              ...

Go to the complete details ...