正则表达式前端js,银行卡号脱敏2023-12-05 20:55:46 方法1 保留卡号的前4位和后4位,中间的都变成*号 > '6212268202014638888'.replace(/(?<=\d{4})\d+(?=\d{4})/," **** **** "); > //6212 **** **** 8888 方法2 > '6212268202014638888'.replace(/^(.{4})(?:\d+)(.{4})$/, "$1 **** **** $2"); > //6212 **** **** 8888 上一篇:观察体系-观察-观察元知识概念的再认知2020-5-6下一篇:UVA10339 【Watching Watches】