Home All Groups Group Topic Archive Search About
Author
3 Oct 2006 10:40 PM
mConrow
I have a textbox that can take a two-digit number (15-99) OR a date in
mm/dd/yyyy format.  The validation expression I am trying to use is:
(([15-99])|((0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)\d\d)). 
This does not work and the validator is firing even when valid entries are
made.  It is clear I have missed something in my formula.
Any help would be much appreciated.
Thank You.

Author
4 Oct 2006 5:35 PM
mConrow
Nevermind.  I found the solution: ^\d{2}$|^(((0?[1-9]|1[012])/(0?[1-9]|1\d|2[0-8])|(0?[13456789]|1[012])/(29|30)|(0?[13578]|1[02])/31)/(19|[2-9]\d)\d{2}|0?2/29/((19|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00)))$

Show quoteHide quote
"mConrow" wrote:

> I have a textbox that can take a two-digit number (15-99) OR a date in
> mm/dd/yyyy format.  The validation expression I am trying to use is:
> (([15-99])|((0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)\d\d)). 
> This does not work and the validator is firing even when valid entries are
> made.  It is clear I have missed something in my formula.
> Any help would be much appreciated.
> Thank You.
Author
7 Oct 2006 2:40 PM
Gaurav Vaish (www.EdujiniOnline.com)
> Nevermind.  I found the solution:
> ^\d{2}$|^(((0?[1-9]|1[012])/(0?[1-9]|1\d|2[0-8])|(0?[13456789]|1[012])/(29|30)|(0?[13578]|1[02])/31)/(19|[2-9]\d)\d{2}|0?2/29/((19|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00)))$

Pretty interesting... uh! :)


--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujinionline.com
http://eduzine.edujinionline.com
-----------------------------------------