let str = '哈哈哈88呵呵呵呵999' let strNew = str.replace(/\d+/g,($1)=>{ return `<span style="color:red">${$1}</span>` }) console.log(strNew)