Thanks.

I just make it work by doing this.

<var-value>^[0-9a-zA-Z-\-]*$</var-value>

I couldn't find info on any strut books. But, here is the original
validation package. Cheers!

http://jakarta.apache.org/regexp/apidocs/org/apache/regexp/RE.html


-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Beal
Sent: Friday, October 01, 2004 1:25 PM
To: [EMAIL PROTECTED]
Subject: Re: validation - mask help

Peng, Meimin wrote:
> Hi, 
> Please help.
> I want to use strut's validation to validate a form field called number.
> This field allows to input text, number and -.
> 
> The code bellows right now is only to validate text and number without
> space.
> How can I make it work with '-'?
> Thanks.
> 
>         <form name="NumEditForm">
>             <field
>                 property="value"
>                 depends="mask">
>                 <msg name="mask"
>                     key="errors.maskmsg"/>
>                 <arg0 key="errors.maskmsg.form.num.edit.value"/>
>                 <var>
>                     <var-name>mask</var-name>
>                     <var-value>^[0-9a-zA-Z]*$</var-value>
>                 </var>
>            </field>           
>         </form>   
> --M
> 
> CONFIDENTIALITY NOTICE:  The information in this e-mail is privileged and
> confidential.  Any use, copying or dissemination of any portion of this
> e-mail by or to anyone other than the intended recipient(s) is
unauthorized.
> If you have received this e-mail in error, please reply to sender and
delete
> it from your system immediately.

What about <var-value>^-?[0-9a-zA-Z]+$</var-value>
That will allow you to enter any positive or negative hexadecimal number.

If you want to allow any of the following:

a--
612-6a-3461
--bc391

you'll need to do something different.


CONFIDENTIALITY NOTICE:  The information in this e-mail is privileged and
confidential.  Any use, copying or dissemination of any portion of this
e-mail by or to anyone other than the intended recipient(s) is unauthorized.
If you have received this e-mail in error, please reply to sender and delete
it from your system immediately.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to