js利用正则表达式替换手机号中间四位为*星号

正则替换手机号中间四位为*


1.示例
在这里插入图片描述
2.方法

replacePhoneToStar: function (phone) {
    
    
        if (phone) {
    
    
            return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
    }
},

猜你喜欢

转载自blog.csdn.net/zcbmwasd/article/details/113111762
今日推荐