我有以下字符串,我想使用 Regex Replace 将所有引号 (") 替换为双引号 ("")。我只想替换那些介于 > 和 < 之间的引号 我该怎么做?
例子: 之前
<Root>
<Elem1>Hello "ds e"" 1293"</Elem1>
<Elem2>sDieo " qqq "" dwe</Elem2>
</Root>
之后
<Root>
<Elem1>Hello ""ds e"""" 1293""</Elem1>
<Elem2>sDieo "" qqq """" dwe</Elem2>
</Root>
没有字符串。请替换,只有正则表达式
请您参考如下方法:
你可以搜索这个并替换:
/"(?![^<]*?>)/g
演示:https://regex101.com/r/vZ9vW0/1
编辑:
包含正则表达式以防止匹配内部标签以外的内容:
"(?=[^<>\n]*?<\/[^<>\n]*>)