在所有条件下都希望对电子邮件进行验证表达式asp.net [英] Want validation expression for Email in all condition asp.net

查看:113
本文介绍了在所有条件下都希望对电子邮件进行验证表达式asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿..

我正在使用正则表达式验证电子邮件地址...

有两种类型的电子邮件,例如
1. xxx@xxx.com
2. xxx@xx.co.in


目前,我的验证表达式是:-

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 :-

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




但是在这种情况下,它仅验证xxx@xxx.com格式...

但是我想以两种格式验证电子邮件

是否有任何表达式可以同时验证这两个...




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...

推荐答案



试试这个

http://www.jquery4u.com/snippets/javascript-validate-email-address-regex / [^ ]
Hi,

Try this

Click me[^]


Copy regular expression from here :

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


我认为以下代码将帮助您在javascript中进行电子邮件验证...



if(document.getElementById(ctl00_MainContent_txtEmailID).value == ||!ValidateEmail(document.getElementById(ctl00_MainContent_txtEmailID)))
{
警报(请输入有效的电子邮件);
document.getElementById(ctl00_MainContent_txtEmailID).value =";
document.getElementById(ctl00_MainContent_txtEmailID).focus();
返回false;
}
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;
}


这篇关于在所有条件下都希望对电子邮件进行验证表达式asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆