var data = document.getElementById('data')
let str = '丽yuan和yuAn'
let reg = 'a'
let rr = 'n'
let result = str.replace(new RegExp(reg, 'gi'), `<span style="color: red;">${reg}</span>`)
let r = result.replace(new RegExp(rr, 'gi'), `<span style="color: red;">${rr}</span>`)
data.innerHTML = r
如何解决以下问题:
不能一次性替换吗。。