regex - 正则表达式:如何替换 xml 属性中的所有嵌套双引号
问题描述
我有这个xml,它可以在属性内嵌套双引号(未转义):
<test>
<tag1 att1="This has "nested double quotes"">
<tag2 att2="This also has a nested " double quotes"></tag2>
</tag1>
</test>
我需要找到一个将选择所有嵌套双引号的正则表达式,在这种情况下
"
嵌套双引号"
- 嵌套
"
双
"
并用字符替换它们。最终的 xml 应如下所示:
<test>
<tag1 att1="This has "nested double quotes"">
<tag2 att2="This also has a nested " double quotes"></tag2>
</tag1>
</test>
是否可以使用正则表达式来实现这一点?
解决方案
推荐阅读
- docker - 如何使用 fluentd 收集 pod 日志并将日志发送到 elasticsearch?
- java - 如何每 X 分钟清除一次应用缓存?
- java - MapStruct:如何过滤我想要和不想映射的字段?
- php - 如何避免 Laravel 单元测试中的 ThrottleRequestsException?
- c - 如何用 C 语言初始化和访问这个结构?
- kotlin - 不带参数的 lambda
- python - 使用循环从熊猫数据框创建多个数据透视表
- excel - 如何制作 Excel 表格 允许唯一条目 使其他人变红
- reactjs - React 生命周期钩子不适用于 redux 状态更新
- jquery - 如何自定义 google 登录弹窗的 css(位置)?