Click here to Skip to main content
15,881,833 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am using the regular expression to validate emails.

/^([\w-]+(?:.[\w-]+))@((?:[\w-]+.)\w[\w-]{0,66}).([a-z]{2,6}(?:.[a-z]{2})(\".+\")?)$/i

So i want to allow the + sign only other special characters are not allowed.

What change I need to make in this pattern?

Thanks Anubhav
Posted

I don't know what do you want to achieve and why, but '+' is a part of Regular Expression syntax, so the only possible problem I can see is knowing that you can escape any character, in this case, '\+'. I did not see this combination of two characters in your Regex sample, that makes me think that this is your problem.

—SA
 
Share this answer
 
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 3-Nov-14 14:27pm    
I suspect that the current OP's problem is just not properly escaping '+'. Please see my answer.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900