Have you tried a simpler regex to make sure that validation is wired up correctly? The one you're currently using will reject valid email addresses (e.g. local+p...@example.com), and it will probably allow invalid ones through (like localp...@example.a.a).
See http://tools.ietf.org/html/rfc2822#section-3.4.1 and http://www.regular-expressions.info/email.html. -Brian On Wed, Mar 31, 2010 at 12:19 PM, seeking_solution <pankajj.j...@gmail.com> wrote: > > tried using - > > <constant-value>^([a-zA-Z0-9]([\w\.-]*[a-zA-Z0-9])*...@[a-za-z0-9]([\w\.-&]*[a-zA-Z0-9])*\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z])[\s]*$</constant-value> > > OR > > <constant-value>^([a-zA-Z0-9]([\w\.-]*[a-zA-Z0-9])*...@[a-za-z0-9]([\w\.-\&]*[a-zA-Z0-9])*\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z])[\s]*$</constant-value> > > still not working. validation xml deploys successfully but validation fails. > not sure whats happening. > > > > seeking_solution wrote: >> >> In struts I have regular expression for validating email like this - >> <constant> >> <constant-name>EMail</constant-name> >> >> <constant-value>^([a-zA-Z0-9]([\w\.-]*[a-zA-Z0-9])*[...@[a-za-z0-9]([\w\.-]*[a-zA-Z0-9])*\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z])[\s]*$</constant-value> >> </constant> >> >> Now I want to allow & in the email. I tried like this >> >> <constant-value>^([a-zA-Z0-9&]([\w\.-]*[a-zA-Z0-9&])*[...@[a-za-z0-9]([\w\.-]*[a-zA-Z0-9])*\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z])[\s]*$</constant-value> >> >> OR >> >> <constant-value>^([a-zA-Z0-9]([\w\.-]*[a-zA-Z0-9])*[...@[a-za-z0-9]([\w\.-&]*[a-zA-Z0-9])*\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z])[\s]*$</constant-value> >> >> I also tried escaping special char using \&. >> >> But its not working. gives error at deploy time. >> >> Please help >> >> > > -- > View this message in context: > http://old.nabble.com/Regular-expressions---Email-Validation-tp28097766p28099106.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org