Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,

Actually i need the help for validating the Email, i completed the validation but customer ask to allow '+'(plus) symbol in email, this is my Regex
@"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
can anyone please help me how to allow the Plus sign for using this Regex or please give Any alternate idea for this.

Regards,
Arunkumar M
Posted
Updated 7-Apr-14 23:27pm
v2

1 solution

since + is a special character , you need to escape plus sign in your regex

something like this

@"^([\w-\.\+]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
 
Share this answer
 
v2
Comments
Arunkumar Murugesan 8-Apr-14 5:56am    
Thank you so much for your response Naz_Firdouse. It work for me. Thanks a lot.
Naz_Firdouse 8-Apr-14 6:02am    
Vote up and mark as answer
Arunkumar Murugesan 8-Apr-14 6:14am    
Hi NAZ_Firdouse , is there any option to allow only for email end with valid domain name like .com,in etc..
Naz_Firdouse 8-Apr-14 6:18am    
In that case , you need to manually specify the domain names you need
Naz_Firdouse 8-Apr-14 6:23am    

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