js全局正则替换html字符串中的闭合标签

802 阅读1分钟

let newStr=string.replace(/<[/]?(u)([^<>]*)>/g, (m)=>m.replace('u', 'span'));

//将u标签替换为Span

image.png