Javascript String isPhone()

Description

Javascript String isPhone()



let regs = {/* w  w w  .j av a2 s  .co m*/
    number: /^[0 - 9] * $/,
    email: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
    phone: /^0*(13|14|15|17|18)\d{9}$/,
};
String.prototype.isPhone = function () {
    return regs.phone.test(this)
}
String.prototype.isEmail = function () {
    return regs.email.test(this);
}



module.exports = regs;



PreviousNext

Related