You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Deepa Khetan <de...@gmail.com> on 2005/12/07 07:31:20 UTC

problem with "mask" of validation

Hi,

Have a problem with validation framework. In the "mask" attribute we specify
which characters are allowed as input. Is there any way in which we can
specify which characters are not allowed as input?

Regards,
Deepa

Re: problem with "mask" of validation

Posted by Deepa Khetan <de...@gmail.com>.
thanks a lot!! my problem is solved now!

On 12/7/05, Jim Reynolds <ji...@gmail.com> wrote:
>
> You should be able to accomplish this with altering the regular
> expression. If you are having troubles with regular expressions,
> search google for perl regular expressions there are a ton of examples
> out there.
>
> eg:
> This states that the match should be from beginning to end of string
> matching 0-9, a-z or A-Z and that is all, no special characters. The *
> means zero or more of these characters.
>
> <var-value>^[0-9a-zA-Z]*$</var-value>
>
> With a regular expression you can say not any of the above by putting
> in a character in the front of the character class.
> <var-value>^[^0-9a-zA-Z]*$</var-value>
>
>
> This is untested, but I have used this type of matching in the past.
>
>
>
> On 12/7/05, Deepa Khetan <de...@gmail.com> wrote:
> > Hi,
> >
> > Have a problem with validation framework. In the "mask" attribute we
> specify
> > which characters are allowed as input. Is there any way in which we can
> > specify which characters are not allowed as input?
> >
> > Regards,
> > Deepa
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: problem with "mask" of validation

Posted by Jim Reynolds <ji...@gmail.com>.
You should be able to accomplish this with altering the regular
expression. If you are having troubles with regular expressions,
search google for perl regular expressions there are a ton of examples
out there.

eg:
This states that the match should be from beginning to end of string
matching 0-9, a-z or A-Z and that is all, no special characters. The *
means zero or more of these characters.

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

With a regular expression you can say not any of the above by putting
in a character in the front of the character class.
<var-value>^[^0-9a-zA-Z]*$</var-value>


This is untested, but I have used this type of matching in the past.



On 12/7/05, Deepa Khetan <de...@gmail.com> wrote:
> Hi,
>
> Have a problem with validation framework. In the "mask" attribute we specify
> which characters are allowed as input. Is there any way in which we can
> specify which characters are not allowed as input?
>
> Regards,
> Deepa
>
>

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