手机脱敏(正在表达式匹配)

'13912345678'.replace(/\d{5}$/g, 'xxxxx');
 
'13912345678'.replace(/(1[3456789]\d{4})\d{5}$/g, '$1xxxxx');
posted @ 2020-08-06 14:20  小窝蜗  阅读(145)  评论(0)    收藏  举报