struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Raible <li...@raibledesigns.com>
Subject time validation mask (hh:mm)
Date Thu, 10 Mar 2005 18:08:53 GMT
I'm trying to validate that the proper format has been used to enter a 
24 hour time.  I'll admit I'm not a regex expert, but I thought the 
following would work.  Actually, I got it from a regex expert friend, 
so I'm just assuming it should work.

         <constant>
             <constant-name>time</constant-name>
             
<constant-value>((?:0?[0-9]|1[0-9]|2[0-3]):[0-5][0-9])</constant-value>
         </constant>

However, this seems to allow alpha-numerics (i.e. 2:00p or 2:00x), when 
I only want digits in the first two places, followed by a colon, 
followed by two more digits.  24:59.  If course, it'd be nice if users 
could enter 1:24 too, but that's not a requirement.

Thanks,

Matt



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message