FYI... A colleague of mine came up with this: ^\d{5}$|^\d{5}-\d{4}$ That does what I want.
Thanks to everyone who replied. -----Original Message----- From: Durham David Cntr 805CSS/SCBE [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 11:57 AM To: Struts Users Mailing List Subject: RE: Validator Forgot second part, try something like ^\d{5}(-\d{4})?$ > -----Original Message----- > From: Alvarado, Juan (c) [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 14, 2003 10:49 AM > To: 'Struts Users Mailing List' > Subject: Validator > > > Can anyone explain to me what this regular expression means: > > ^\d{5}\d*$ -- Zip validation that comes with the validator > > I thought it meant you could only type in a five digit zip > code. Ex: 33634 > > However, I am allowed to type: 3363455 and that works. > > Of course, since I am no expert on regular expressions, I am sure I am > missing something. > > What I basically need to accomplish is to allow a user to be > able to type in > a zip code in two formats and only those two formats: > > 33634-6661 OR 33634 > > Any help is greatly appreciated. > > Thanks > > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>