That expression does exactly what you ask of it: checks if there is a
combination of five digits *somewhere* in the input string. You'll have
to anchor the expression to do what you really want.
So ^\d{5}$ should work.
-Filip
On 2008-04-16 02:39, Sige wrote:
i might have found the reason:
it is not that @Validate("regexp") doesnt work, it
actually checked the input and think the input is
valid. However, it dosnt check the rest of the string.
for example:
zip-regexp=\\d{5}
@Validate("regexp") checks only the first 5 chars in
the input, and doesnt care about those following, and
all the following inputs would be valid:
12345
12345a
12345abcd
....
i have tested Tapestry 5.0.9 and 5.0.11 tutorial, and
i think this may be a bug.
Cheers
Sige
--- Sige <[EMAIL PROTECTED]> wrote:
Thank you, but still no luck.
the only difference is that i use tomcat and i don't
pack the classes into a jar file. this doesn't seem
to
be the problem, since regular expressions provided
in
the tutorial work fine, such as:
zip-regexp=\\d{5}(-\\d{4})?
credit-regexp=\\d{4}(\\-?\\d{4}){3}
Cheers,
Sige
--- Lance Java <[EMAIL PROTECTED]> wrote:
Since your regex is defined in a property file,
you
don't need to escape
your backslashes as you do with a java string.
try \-*\d*\.*\d*
Cheers,
Lance.
On 15/04/2008, Filip S. Adamsen <[EMAIL PROTECTED]>
wrote:
That's odd, it works for me alright... Tapestry
doesn't do anything
special wrt. regular expressions, it just uses
the
java.util.regex stuff.
-Filip
Sige skrev:
It seems @Validate("regexp") only support
fixed
number
of matches such as \\d{4}, and doesnt support
"one or
more" or "zero or more" matches(\\d* or \\d+).
Sige
--- Sige <[EMAIL PROTECTED]> wrote:
Hi,
I have tried to use a @Validate("regexp")
to
validate
a number field, the regexp used is:
numField-regexp=\\-*\\d*\\.*\\d*
However this doesnt work in T5 (5.0.9), the
validation
is simply ignored, i have tested the regular
expression in Java correct. I wonder if T5
supports
all java.util.regex.Pattern, or what I have
gone
wrong?
Thanks
Sige
Send instant messages to your online friends
http://au.messenger.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
Send instant messages to your online friends
http://au.messenger.yahoo.com
---------------------------------------------------------------------
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]
Send instant messages to your online friends
http://au.messenger.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
Send instant messages to your online friends http://au.messenger.yahoo.com
---------------------------------------------------------------------
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]