var card='123845785238542307'; var strcard=card.replace(/^(.{4})(?:\d+)(.{4})$/,"$1******$2"); console.log(strcard) let now_money = "9947.52" let m = parseInt(now_money) console.log(m); let str = m.toString() let s = str.substr(1,1) let e = str.substr(str.length-1,1) console.log(s+'**'+e)