【发布时间】:2016-05-19 09:53:34
【问题描述】:
我有这个 XML,我正在尝试删除这些:
Name="items"
Name="shipmentsShipmentIndex"
“名称”不会改变,
要改变的词是引号之间的词,在这个例子中:
items 和 shipmentsShipmentIndex
<?xml version="1.0" encoding="UTF-8"?>
<RootDTO xmlns:json='http://james.newtonking.com/projects/json'>
<destination>
<name>XXX</name>
</destination>
<orderData>
<items json:Array='true'>
<shipmentIndex Name="items">0</shipmentIndex>
</items>
<items json:Array='true'>
<shipmentIndex Name="items">0</shipmentIndex>
</items>
<shipments json:Array='true'>
<shipmentIndex Name="shipmentsShipmentIndex">0</shipmentIndex>
</shipments>
</orderData>
</RootDTO>
我怎样才能找到所有这些事件并删除它们(或什么都不替换)?
我尝试了一堆变体,例如:Name{1}[a-zA-Z]+"\b
【问题讨论】:
-
尝试基本替换:
\bName="[^"]*"=>Name="NEW_VALUE" -
据我所见,它的“A word边界”
-
@WiktorStribiżew 不理解您的解决方案-“尝试基本替换”
-
看下面的答案,我想这就是你所需要的。