富文本样式替换

示例,将<span>标签里面的样式全替换

 str = str.replace(/<span[^>]*>/gi, function (match) {
                                return match.replace(/style\s*?=\s*?([‘"])[\s\S]*?\1/gi, 'style="font-size: 12px; color: #c6c6c6"') // 替换style
                            })

猜你喜欢

转载自blog.csdn.net/weixin_40918145/article/details/134513436