银行卡隐藏中间的几位 var str = "111111111111"; var reg = /^(\d{4})\d+(\d{4})$/; str = str.replace(reg, "$1****$2");