<script>
let a = ['123','asd']
//允许中间有空格
a = a.map(item => {
let arr = item.split('').join(' {0,}')
return arr
})
//
let str = "saldnkjasbdkjasd 123dasdasd4123sdasd11asd123daaaa"
let re = new RegExp(`(${a.join('|')})`,'ig')
let res = str.replace(re, function(word, index,sss){
console.log(word, index,sss,"index")
return '<span id="bigkeyword" style="background:yellow;color:red;">' + word + '</span>'
})
console.log(res,"res")
</script>