Ahh. I built a regex parser the long way (you can see it in 0.0.5), where
months = "(01|02|03..." and so on. This works ok, catching many errors but
can't catch if a user enters 31 as a day in a month with 30 days and so on.
I like your idea better. Hmm... this could be cool. I'm going to try to
figure a way to pass a function as a validator as an alternative to a regex
string. Will try working with wxDateTime tonight.
Thanks for the great idea!
Regards,
Jeff
···
-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Thursday, February 13, 2003 3:54 PM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] parsing dates [was: wxMaskedTextCtrl 0.0.4
(with fries!)]
A non regex approach to validating dates that might be interesting is to
use one of wxDateTime's Parse* methods. They will allow dates and/or
times in various formats, different separators, even spelling the months.
The return value is either -1 or the index of the string where it had to
stop parsing, so if it returns the length of the input string then it
should be a valid date.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org