1、替换除首尾字符以外的字符为* name = name.replace(/(\S{1})(\S*)(\S{1})/, '$1'+new Array(name.length-1).join('*')+'$3');