Click here to Skip to main content
15,893,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
heyy..

I am using a regular expression validation for Email Address...

There is two type of Email like
1. xxx@xxx.com
2. xxx@xx.co.in


Currently My validation expression is :-

C#
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"



But in this condition it validate only xxx@xxx.com format...

But I want to validate the email in both format

Is there is any expression to validate both...
Posted
Updated 1-Jul-13 23:14pm
v2
Comments
jaideepsinh 2-Jul-13 3:35am    
Test properly because this validation work in both condition.
This is not check .co.in or .com this will only check only this format xx@xxx.xxx
aravindnass 2-Jul-13 4:22am    
If I type xxx@xx.co.in I got error (display validation)..
vijay__p 2-Jul-13 5:13am    
It should work in both the conditions....
aravindnass 3-Jul-13 1:08am    
yes ..it works, but it doesn't work in this condition xxx@xx.com.mcom.com.bbvom.com

i think the below code will help u for email validation in javascript...



if(document.getElementById(ctl00_MainContent_txtEmailID).value == || !ValidateEmail(document.getElementById(ctl00_MainContent_txtEmailID)))
{
alert(Please Enter Valid Email);
document.getElementById(ctl00_MainContent_txtEmailID).value = "";
document.getElementById(ctl00_MainContent_txtEmailID).focus();
return false;
}
 
Share this answer
 
Comments
aravindnass 2-Jul-13 5:39am    
where is the validateEmail function?
satyaanupama 2-Jul-13 5:49am    
"^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$"
Hi,

Try this

Click me[^]


Copy regular expression from here :

http://www.jquery4u.com/snippets/javascript-validate-email-address-regex/[^]
 
Share this answer
 
v2

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