我有一个包含以下数据的 XML 文件
<Shipment>
<Shipper>
<Name>Clothes</Name>
<Address1>Apparel Street</Address1>
<Country>GB</Country>
</Shipper>
<Shopper>
<Name>ABC</Name>
<Address1>Street 1</Address1>
<Country>IE</Country>
</Shopper>
</Shipment>
<Shipment>
<Shipper>
<Name>Clothes</Name>
<Address1>Apparel Street</Address1>
<Country>GB</Country>
</Shipper>
<Shopper>
<Name>XYZ</Name>
<Address1>Street 9</Address1>
<Country>US</Country>
</Shopper>
</Shipment>
我只想将购物者地址更改为特定地址,如下所示
<Shipment>
<Shipper>
<Name>Clothes</Name>
<Address1>Apparel Street</Address1>
<Country>GB</Country>
</Shipper>
<Shopper>
<Name>ABC</Name>
<Address1>Wonderland</Address1>
<Country>CA</Country>
</Shopper>
</Shipment>
<Shipment>
<Shipper>
<Name>Clothes</Name>
<Address1>Apparel Street</Address1>
<Country>GB</Country>
</Shipper>
<Shopper>
<Name>XYZ</Name>
<Address1>Wonderland</Address1>
<Country>CA</Country>
</Shopper>
</Shipment>
让我知道是否有任何简单的方法可以使用 Notepad++ 中的查找和替换选项来解决此问题
谢谢
(<Shopper>(?:(?!</Shopper>)[\s\S])+?<Address1>).+?(</Address1>[\s\S]+?<Country>).+?(</Country>)
$1Wonderland$2CA$3
. matches newline
解释:
替代品:
截图(之前):
截图(之后):