正则表达式前端js,银行卡号脱敏
作者:互联网
方法1
保留卡号的前4位和后4位,中间的都变成*号
> '6212268202014638888'.replace(/(?<=\d{4})\d+(?=\d{4})/," **** **** ");
> //6212 **** **** 8888
方法2
> '6212268202014638888'.replace(/^(.{4})(?:\d+)(.{4})$/, "$1 **** **** $2");
> //6212 **** **** 8888
标签:8888,正则表达式,6212268202014638888,位和后,replace,6212,js,脱敏 来源: https://blog.csdn.net/qq_44741441/article/details/120768485