字符串脱敏

  • 身份证号码隐藏
const cardNo = idCard.replace(/^(.{6})(?:\w+)(.{4})$/, "\$1********\$2")
  • 手机号脱敏处理
const mobile = mobile.replace(/^(.{3}).*(.{4})$/, "\$1****\$2")

你可能感兴趣的:(字符串脱敏)