【正则】手机号中间四位显示*
function checkNumber(theObj) { var reg = /^[0-9]+\.?[0-9]*$/; if (reg.test(theObj)) { return true; } return false; }
newPhone= phone.replace(/^(\d{3})\d{4}(\d+)/,"$1****$2");
结果:
138****0157
function checkNumber(theObj) { var reg = /^[0-9]+\.?[0-9]*$/; if (reg.test(theObj)) { return true; } return false; }