fenzhi-utils
Version:
分值前端项目的js函数库
18 lines (17 loc) • 478 B
JavaScript
/**
* 验证手机号
* @param {string} phoneNumber
* @returns
*/
/**
CustomValidatePhone('13912345678');// true
CustomValidatePhone('18888888888');// true
CustomValidatePhone('13567891234');// true
CustomValidatePhone('12345678901');// false
CustomValidatePhone('2345678901');// false
CustomValidatePhone('1391234567');// false
*/
export function CustomValidatePhone(phoneNumber) {
const regex = /^1[3456789]\d{9}$/;
return regex.test(phoneNumber);
}