Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regular Expression dd-mmm-yyyy in asp.net

Status
Not open for further replies.

pabby

IS-IT--Management
Jan 5, 2004
47
GB
HI,

I have been searching for a regex that will let me validate a textbox contents in dd-mmm-yyyy format, but I am having difficulty finding one that works

can anyone help?

thanks,

Paul
 
Try this one, taken from regexlib.com

^((31(?!\ (Feb(ruary)?|Apr(il)?|June?|(Sept|Nov)(ember)?)))|((30|29)(?!\ Feb(ruary)?))|(29(?=\ Feb(ruary)?\ (((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\d|2[0-8])\ (Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sept|Nov|Dec)(ember)?)\ ((1[6-9]|[2-9]\d)\d{2})$

It may need editing as it matches with a space, not a hyphen, ie 31 March 2004 is a match
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top