【发布时间】:2015-08-17 18:59:49
【问题描述】:
我有以下字符串,我想使用 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>
没有字符串。请替换,只有正则表达式
【问题讨论】:
-
不需要正则表达式。使用:string output = input.Replace("\"", "\"\"");
-
我什至不知道从哪里开始。这就是为什么我问...
-
@jdweng 它也会替换 xml 中的任何属性。