Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi im using this this below expression to validated email
/^([0-9a-zA-Z_]+[-._+])*[0-9a-zA-Z_]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$/

its working fine. but i need to give the validation alert when user entered _ before the @ symbol. like this email[abc_C_@abc.com]

i dont know how to remove. so pls advice me to close it shortly

What I have tried:

if i remove _ then the entire underscore will be consider.
Posted
Updated 23-Dec-16 3:41am

Quote:
i don't know how to remove.
Why do you want to remove the _ which is perfectly legal.

Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]
 
Share this answer
 
Comments
sencsk 3-Jan-17 2:48am    
actually the user entered emailid and other details which i pass it to another third party application. so input for the third party application is not supported my case so i should remove it properly. this is my requirements too
Patrice T 3-Jan-17 5:23am    
What do you want to do exactly ?
Validate ? Detect ? Alert ? remove ?
Show example.
Use Improve question to update your question.
try this,

/^([0-9a-zA-Z_]+[-._+])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$/
 
Share this answer
 

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