[正则]最正确的邮箱 email 正则表达式

Skiy 2017-5-26 573

从百度网盘的扒下来的邮箱验证表达式

邮箱验证最完美的解决方案:

var reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
console.log('\r\n表达式为:%s \r\n', reg);
 
var vallist = [
'[email protected]',
'[email protected]_c.com',
'[email protected]_.com',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]_a.com',
'[email protected]__.com',
'[email protected]_.com',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]_q.qq.com',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]你好.中国',
'[email protected]你.中',
'[email protected]',
'[email protected]',
];
 
for (k in vallist) {
        console.log(vallist[k], reg.test(vallist[k]));
}
最新回复 (0)
返回
发新帖