Regex for Date onkeypress
Posted on 2011-02-18
Is it possible to write a regular expression to Validate a date in the onkeypress event of a textbox?
The user should be able to enter dates in the following formats.
1. MM/dd/yyyy - 12/25/2011
2. MMMM dd, yyyy - December 25, 2011
3. dd MMM,yyyy - 25 Dec,2011
I have a dropdown in which the user will select the format of the date to be entered, so I would require 3 different Regex.
I can write a regex on blur event. But is it possible to write it in keypress event of textbox.