标签:中间 pre ace turn code let tps replace 使用
使用正则将手机号中间四位转换为 *
号:
let mobile = "131 0000 8080" function convertMobile(mobile){ const mobileReg = /(\d{3})(\d{4})(\d{4})/ig; let mobileCalc = mobile.replace(/\s+/ig,""); mobileCalc = mobileCalc.replace(mobileReg,"$1****$3"); return mobileCalc; } convertMobile(mobile); //131****8080
来自:https://www.jianshu.com/p/7ef31e4a3587
标签:中间 pre ace turn code let tps replace 使用
原文地址:https://www.cnblogs.com/setbug/p/14469435.html