Quid pro quo for answering my CSS post... :-)
Just surround your pattern with start-of-line (^) and end-of-line ($)
chars and you should get the behavior you desire:
<constant>
<constant-name>time</constant-name>
<constant-value>^((?:0?[0-9]|1[0-9]|2[0-3]):[0-5][0-9])$</constant-value
>
</constant>
Incidentally, I came across this useful utility for regular expression
testing called the RegEx coach: http://www.weitz.de/regex-coach/
Doesn't teach you anything about regex, but it's a great debugging tool.
- Scott
-----Original Message-----
From: Matt Raible [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 10, 2005 1:09 PM
To: Struts Users Mailing List
Subject: time validation mask (hh:mm)
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]