想要一个邮箱验证的 正则表达式 可以验证 [email protected]这种的.... 想要一个邮箱验证的 正则表达式 可以验证 [email protected]这种的.... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$这很通用,如果非要net,可以把红色替换成net。不同的编程语言有不同使用正则方法,但差异不大。试试看。 sorry,上面我试过,有问题,换成这个试试^[\w\-\.]+@[\w\-\.]+(\.\w+)+$ /^[a-zA-Z0-9_\-\.]+\@[a-zA-Z0-9_\-\.]+[.][a-zA-Z0-9_\-\.]+$/ var reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;alert(reg.test("[email protected]")); regex = "^\\w+((-\\w+)|(\\.\\w+))*\\@\\w+((\\.|-)\\w+)*\\.\\w+$"; <html><head></head><body> <script> var str = ['[email protected]', '[email protected]', '[email protected]', 'test-123#163.com'], reg = /^\w+(\-[A-Za-z0-9])*\w+\@\w+(\-[A-Za-z0-9])*\w+\.(?:net|cn|com)$/; for(var i in str){ document.write(str[i]+": "+reg.test(str[i])+"<br/>"); } </script></body></html> 上面有错误,修正下<html><head></head><body> <script> var str = ['[email protected]', '[email protected]', '[email protected]', 'test-123#163.com'], reg = /^\w+(\-[A-Za-z0-9]\w+)*\@\w+(\-[A-Za-z0-9]\w+)*\.(?:net|cn|com)$/; for(var i in str){ document.write(str[i]+": "+reg.test(str[i])+"<br/>"); } </script></body></html> /^\+?[a-z0-9](([-+.]|[_]+)?[a-z0-9]+)*@([a-z0-9]+(\.|\-))+[a-z]{2,6}$/ Jquery 修改页面文字 正则如何取得<img.*>或<img>标签? 层左侧距离 js正则问题 数据长度判断 怎样捕获 ie弹出保存对话框的事件??? 一个很奇怪的问题--关于html实现表单提交 如何用JS来验证文件是*.gif和*.jpg文件,而不是其他文件 GGJJ,请问一下,文件的查找的代码怎么写。我不是用数据库生成的,只是如产生文件夹,放在硬盘路径下面。让用户自己在文件夹中添加文件, 如何用javascript实现在框架之间传递参数 js问题,求正解! js中getElementsByTagName固体是干什么的?
这很通用,如果非要net,可以把红色替换成net。
不同的编程语言有不同使用正则方法,但差异不大。
试试看。
^[\w\-\.]+@[\w\-\.]+(\.\w+)+$
var reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
alert(reg.test("[email protected]"));
regex = "^\\w+((-\\w+)|(\\.\\w+))*\\@\\w+((\\.|-)\\w+)*\\.\\w+$";
<head>
</head>
<body>
<script>
var str = ['[email protected]', '[email protected]', '[email protected]', 'test-123#163.com'],
reg = /^\w+(\-[A-Za-z0-9])*\w+\@\w+(\-[A-Za-z0-9])*\w+\.(?:net|cn|com)$/;
for(var i in str){
document.write(str[i]+": "+reg.test(str[i])+"<br/>");
}
</script>
</body>
</html>
<head>
</head>
<body>
<script>
var str = ['[email protected]', '[email protected]', '[email protected]', 'test-123#163.com'],
reg = /^\w+(\-[A-Za-z0-9]\w+)*\@\w+(\-[A-Za-z0-9]\w+)*\.(?:net|cn|com)$/;
for(var i in str){
document.write(str[i]+": "+reg.test(str[i])+"<br/>");
}
</script>
</body>
</html>