1、大概思路就是判断带没有带@符号,然后时以.cn/.com等结尾,@后面还必须要有字符,就可以为邮箱了,
2、这里喔就直接贴代码了。大家拿过去排下版就可以用了。
/**
* @author Rui.Zhang
* @description 判断数据是否为邮箱
* @param {String} str_data 待校验的数据
* @returns {Boolean}, true:是邮箱
**/
isEmail : function (str_data) {
str_data = str_data || String(this);
return /^([a-zA-Z0-9_-]{1,16})@([a-zA-Z0-9]{1,9})(\.[a-zA-Z0-9]{1,9}){0,3}(\.(?:com|net|org|edu|gov|mil|cn|us)){1,4}$/.test(str_data);
},