标签:
// 判断是否为邮箱地址
function isEmail(emailStr) {
var reg = /[\d\w\._-]+@[\d\w]+\.[\w]+/;
return reg.test(emailStr);
}
console.log(isEmail(‘were.eee-ew_er@123.com‘));
// 判断是否为手机号
function isMobilePhone(phone) {
var reg = /^1[358]\d{9}$/;
return reg.test(phone);
}
console.log(isMobilePhone(13650951774))
标签:
原文地址:http://www.cnblogs.com/pssp/p/5277108.html