<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Changing the closing tag on a XML file, so it matches the opening tag, with notepad++ -]]></title><description><![CDATA[<p dir="auto">I have a issue, i have a big XML file, and using notepad++.</p>
<p dir="auto">I have this XML syntax:</p>
<pre><code>   &lt;wp:postmeta-ingredients&gt;
    &lt;wp:meta_key&gt;&lt;![CDATA[ingredients_list_0_name]]&gt;&lt;/wp:meta_key&gt;
    &lt;wp:meta_value&gt;&lt;![CDATA[Tészta]]&gt;&lt;/wp:meta_value&gt;
    &lt;/wp:postmeta&gt;
</code></pre>
<p dir="auto">What i want, is to change the closing tag to:</p>
<pre><code>    &lt;wp:postmeta-ingredients&gt;
    &lt;wp:meta_key&gt;&lt;![CDATA[ingredients_list_0_name]]&gt;&lt;/wp:meta_key&gt;
    &lt;wp:meta_value&gt;&lt;![CDATA[Tészta]]&gt;&lt;/wp:meta_value&gt;
    &lt;/wp:postmeta-ingredients&gt;
</code></pre>
<p dir="auto">I have other data like this:</p>
<pre><code>    &lt;wp:postmeta&gt;
    &lt;wp:meta_key&gt;&lt;![CDATA[ingredients_list_0_ingredients_1_quantity]]&gt;&lt;/wp:meta_key&gt;
    &lt;wp:meta_value&gt;&lt;![CDATA[2000]]&gt;&lt;/wp:meta_value&gt;
    &lt;/wp:postmeta&gt;
</code></pre>
<p dir="auto">That i want to keep the same. So its just when the opening tag is starting with:</p>
<pre><code>&lt;wp:postmeta-ingredients&gt;
</code></pre>
<p dir="auto">How do i do this in notepad++, have to be with “replace all”</p>
<p dir="auto">Thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/22534/changing-the-closing-tag-on-a-xml-file-so-it-matches-the-opening-tag-with-notepad</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 00:33:56 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/22534.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 09 Feb 2022 15:57:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Changing the closing tag on a XML file, so it matches the opening tag, with notepad++ - on Fri, 11 Feb 2022 14:03:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a> said in <a href="/post/73967">Changing the closing tag on a XML file, so it matches the opening tag, with notepad++ -</a>:</p>
<blockquote>
<p dir="auto">FIND = (?s)<a rel="nofollow ugc">wp:postmeta-ingredients</a>.*?\K&lt;/wp:postmeta&gt;<br />
REPLACE = &lt;/wp:postmeta-ingredients&gt;<br />
SEARCH MODE = Regular Expression<br />
REPLACE ALL (because of \K, hitting REPLACE multiple times will not work)</p>
</blockquote>
<p dir="auto">Ehh, wow, fast and correct answer, worked like a charm.<br />
Super impress of the quality here.</p>
<p dir="auto">Thank you so much Peter :)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74063</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74063</guid><dc:creator><![CDATA[nrh_10_2022]]></dc:creator><pubDate>Fri, 11 Feb 2022 14:03:17 GMT</pubDate></item><item><title><![CDATA[Reply to Changing the closing tag on a XML file, so it matches the opening tag, with notepad++ - on Wed, 09 Feb 2022 16:09:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nrh_10_2022" aria-label="Profile: nrh_10_2022">@<bdi>nrh_10_2022</bdi></a></p>
<p dir="auto">Thank you for showing before and after data, in boxes, with data that should match and data that shouldn’t. It makes your question easier to understand.</p>
<p dir="auto">If I have</p>
<pre><code>&lt;wp:postmeta-ingredients&gt;
&lt;wp:meta_key&gt;&lt;![CDATA[ingredients_list_0_name]]&gt;&lt;/wp:meta_key&gt;
&lt;wp:meta_value&gt;&lt;![CDATA[Tészta]]&gt;&lt;/wp:meta_value&gt;
&lt;/wp:postmeta&gt;

&lt;wp:postmeta&gt;
&lt;wp:meta_key&gt;&lt;![CDATA[ingredients_list_0_ingredients_1_quantity]]&gt;&lt;/wp:meta_key&gt;
&lt;wp:meta_value&gt;&lt;![CDATA[2000]]&gt;&lt;/wp:meta_value&gt;
&lt;/wp:postmeta&gt;

&lt;wp:postmeta-ingredients&gt;
&lt;wp:meta_key&gt;&lt;![CDATA[ingredients_list_0_name]]&gt;&lt;/wp:meta_key&gt;
&lt;wp:meta_value&gt;&lt;![CDATA[Tészta]]&gt;&lt;/wp:meta_value&gt;
&lt;/wp:postmeta&gt;

&lt;wp:postmeta&gt;
&lt;wp:meta_key&gt;&lt;![CDATA[ingredients_list_0_ingredients_1_quantity]]&gt;&lt;/wp:meta_key&gt;
&lt;wp:meta_value&gt;&lt;![CDATA[2000]]&gt;&lt;/wp:meta_value&gt;
&lt;/wp:postmeta&gt;
</code></pre>
<ul>
<li>FIND = <code>(?s)&lt;wp:postmeta-ingredients&gt;.*?\K&lt;/wp:postmeta&gt;</code></li>
<li>REPLACE = <code>&lt;/wp:postmeta-ingredients&gt;</code></li>
<li>SEARCH MODE = Regular Expression</li>
<li>REPLACE ALL (because of \K, hitting REPLACE multiple times will not work)</li>
</ul>
<p dir="auto">becomes</p>
<pre><code>&lt;wp:postmeta-ingredients&gt;
&lt;wp:meta_key&gt;&lt;![CDATA[ingredients_list_0_name]]&gt;&lt;/wp:meta_key&gt;
&lt;wp:meta_value&gt;&lt;![CDATA[Tészta]]&gt;&lt;/wp:meta_value&gt;
&lt;/wp:postmeta-ingredients&gt;

&lt;wp:postmeta&gt;
&lt;wp:meta_key&gt;&lt;![CDATA[ingredients_list_0_ingredients_1_quantity]]&gt;&lt;/wp:meta_key&gt;
&lt;wp:meta_value&gt;&lt;![CDATA[2000]]&gt;&lt;/wp:meta_value&gt;
&lt;/wp:postmeta&gt;

&lt;wp:postmeta-ingredients&gt;
&lt;wp:meta_key&gt;&lt;![CDATA[ingredients_list_0_name]]&gt;&lt;/wp:meta_key&gt;
&lt;wp:meta_value&gt;&lt;![CDATA[Tészta]]&gt;&lt;/wp:meta_value&gt;
&lt;/wp:postmeta-ingredients&gt;

&lt;wp:postmeta&gt;
&lt;wp:meta_key&gt;&lt;![CDATA[ingredients_list_0_ingredients_1_quantity]]&gt;&lt;/wp:meta_key&gt;
&lt;wp:meta_value&gt;&lt;![CDATA[2000]]&gt;&lt;/wp:meta_value&gt;
&lt;/wp:postmeta&gt;
</code></pre>
<p dir="auto">The regex is looking for <code>&lt;wp:postmeta-ingredients&gt;</code> followed by any character(s) before the first <code>&lt;/wp:postmeta&gt;</code> it reaches; then it resets (so all the stuff that’s matched so far will not be replaced), then matches <code>&lt;/wp:postmeta&gt;</code>, and replaces just that last part of the match with  <code>&lt;/wp:postmeta-ingredients&gt;</code>.</p>
<p dir="auto">Barring unforeseen on edge cases, I think this should work for you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73967</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73967</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 09 Feb 2022 16:09:37 GMT</pubDate></item></channel></rss>