^([a-zA-Z]+['-\s])*$ That's top of my head ... and my head is tired :-( but maybe it's helpful. You need to separate the repeating things from the non-repeating things, and allow the two of them to be chained multiple times. Having such complete validation of a name seems error-prone at best though, since names can take on such diverse forms. You're likely to wind up turning down someone's correct name as invalid because your pattern doesn't fit their name. I don't know about you, but if you turned my name down as invalid, and I entered it correctly, it would aggravate me :-)
On Sun, 19 Dec 2004 23:36:48 -0500, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > 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 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Eddie Bush --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]