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:
i
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 car
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,
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
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"
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 u