You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by seeking_solution <pa...@gmail.com> on 2010/03/31 11:42:20 UTC
Regular expressions - Email Validation
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>
But its not working. gives error at deploy time.
Please help
--
View this message in context: http://old.nabble.com/Regular-expressions---Email-Validation-tp28093593p28093593.html
Sent from the Struts - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: Regular expressions - Email Validation
Posted by Philip Luppens <ph...@gmail.com>.
Please ask on the user mailing list.
And keep in mind: you're editing an XML file, so you'll have to escape
your ampersand (& -> &).
HTH,
Phil
On Wed, Mar 31, 2010 at 12:42 PM, seeking_solution
<pa...@gmail.com> 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>
>
> But its not working. gives error at deploy time.
>
> Please help
> --
> View this message in context: http://old.nabble.com/Regular-expressions---Email-Validation-tp28093593p28093593.html
> Sent from the Struts - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>
--
"We cannot change the cards we are dealt, just how we play the hand."
- Randy Pausch
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: Regular expressions - Email Validation
Posted by shekher awasthi <sh...@gmail.com>.
Its better to ask such question at user list..
it will get to a wider range of people..
sorry i am also not much comfortable in Regular expression
On Wed, Mar 31, 2010 at 3:12 PM, seeking_solution <pa...@gmail.com>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>
>
> But its not working. gives error at deploy time.
>
> Please help
> --
> View this message in context:
> http://old.nabble.com/Regular-expressions---Email-Validation-tp28093593p28093593.html
> Sent from the Struts - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>