Reputation: 25
I have an XML file which I want to modify with Notepad++. All I want is to delete all characters and lines (simply everything) between two "properties" tags.
<properties>
<property>
<propertyName>controlPanelDemoURL</propertyName>
<propertyValues>
<propertyValue>http://domain.com</propertyValue>
</propertyValues>
</property>
</properties>
It should look like this:
<properties>
</properties>
What regular expresion (or Notepad++ extended search) should I use?
I've tried <properties>.*</properties>
but it works only when everything is located in one line.
Thanks l'L'l. Now I realized I have other problem. Tag <properties></properties>
is a part of main <template></template>
tag. There is a lot "template" items in this xml file. After using <properties>.*</properties>
and replacing with dot matches new line, I'm deleting all of code, started from first until last and every other tag between.
Simplfied XML file structure look like this:
<templates>
<template id="1">
<id></id>
<state></state>
<price></price>
<type_name></type_name>
<live_preview_url></live_preview_url>
<properties>
<property>
<propertyName></propertyName>
<propertyValues>
<propertyValue></propertyValue>
</propertyValues>
</property>
</properties>
</template>
<template id ="2">
<id></id>
<state></state>
<price></price>
<type_name></type_name>
<live_preview_url></live_preview_url>
<properties>
<property>
<propertyName></propertyName>
<propertyValues>
<propertyValue></propertyValue>
</propertyValues>
</property>
</properties>
</template>
</templates>
Upvotes: 1
Views: 3065
Reputation: 12110
Find
<properties>.*?</properties>
And replace with
<properties></properties>
Use Regular expressions
and . matches a newline
Upvotes: 2