That doesn't address the issue of having multiple - and ' characters
together. Plus, it will only allow two-section names. Regular
expressions are fantastic, if you can find one to suit your needs. It
can often be difficult to arrive at an apropriate expression though
:-( Power brings complexity ... who'da thunk it.
On Mon, 20 Dec 2004 13:52:07 +0000, Ruben Cepeda
<[EMAIL PROTECTED]> wrote:
> Hey,
> Why not try this regex: ^[a-zA-Z'-]*\s[a-zA-Z'-]*$
>
> *************************************
> Ruben Cepeda
> [EMAIL PROTECTED]
> *************************************
>
> ----Original Message Follows----
> From: <[EMAIL PROTECTED]>
> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Subject: Struts Form Validation Question
> Date: Sun, 19 Dec 2004 23:36:48 -0500
>
> Hi,
>
> I am using struts validator plugin. I have form field which requires
> following validation:
> "Full Name can contain only letters, dashes (-), apsotrophes(') and
> single spaces"
>
> Here is the regex I am using for this validation : ^[a-zA-Z'-\s]*$
> The only problem with this regex is that it allows user to enter more
> than one consecutive blank space in the field.
> So I landed up putting the check for double space in the Struts Form
> bean Validate method.
>
> Dividing the validation in two parts has created a scenario when some
> time user see the same error message twice because
> validation failed in plugin as wells in form validate method.
>
> For the time being I have changed the two message little bit so user is
> not confused. But I would like to show only one message
> irrespective of where the validation failed.
>
> Any Ideas ?
>
> Thanks for help!
>
> Rajesh Shah
>
--
Eddie Bush
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]