<?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[How changing several similar HTML tags by RegEx?]]></title><description><![CDATA[<p dir="auto">Hello to all, my newbie post…</p>
<p dir="auto">How changing several similar HTML tags by RegEx?</p>
<p dir="auto">Starting point:<br />
&lt;li class=“h6”&gt; including various text1, tags and so on &lt;/li&gt;<br />
something else1<br />
&lt;li class=“h6”&gt; including various text2, tags and so on &lt;/li&gt;<br />
something else2<br />
&lt;li class=“h6”&gt; including various text3, tags and so on &lt;/li&gt;</p>
<p dir="auto">I want to change all to:<br />
&lt;h6&gt; including various text1, tags and so on &lt;/h6&gt;<br />
something else1<br />
&lt;h6&gt; including various text2, tags and so on &lt;/h6&gt;<br />
something else2<br />
&lt;h6&gt; including various text3, tags and so on &lt;/h6&gt;</p>
<p dir="auto">First problem:<br />
If using RegEx  &lt;li class=“h6”&gt;(.*)&lt;/li&gt;<br />
first &lt;li class=“h6”&gt; and last/third &lt;/li&gt; is found, but only if “find \r and \n” is activated.<br />
But closing next &lt;/li&gt; corresponding to it’s opening tag &lt;li class=“h6”&gt; must be found.</p>
<p dir="auto">Second problem:<br />
Search-and-replace shall not alter different included text1, text2, text3 between the opening &lt;h6&gt; and corresponding closing &lt;/h6&gt;.</p>
<p dir="auto">How to get this working?</p>
<p dir="auto">Thanks for help and kind regards</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/18475/how-changing-several-similar-html-tags-by-regex</link><generator>RSS for Node</generator><lastBuildDate>Fri, 05 Jun 2026 22:02:39 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/18475.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 07 Nov 2019 07:08:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How changing several similar HTML tags by RegEx? on Fri, 08 Nov 2019 19:29:35 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/48365">How changing several similar HTML tags by RegEx?</a>:</p>
<p dir="auto">You are my hero, thanks very much, working!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/48389</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/48389</guid><dc:creator><![CDATA[bert maier]]></dc:creator><pubDate>Fri, 08 Nov 2019 19:29:35 GMT</pubDate></item><item><title><![CDATA[Reply to How changing several similar HTML tags by RegEx? on Thu, 07 Nov 2019 14:26:11 GMT]]></title><description><![CDATA[<p dir="auto">With</p>
<ul>
<li>Find = <code>&lt;li class="h6"&gt;(.*)&lt;/li&gt;</code></li>
<li>Replace = <code>&lt;h6&gt;$1&lt;/h6&gt;</code> – the <code>$1</code> takes the contents from the first matched parentheses group, hence “shall not alter different included text”</li>
<li><code>☐ . matches newline</code> disabled</li>
</ul>
<p dir="auto">It should work as desired – the included text stays the same, but each pair of <code>&lt;li...&gt;...&lt;/li&gt;</code> changes.</p>
<p dir="auto">With</p>
<ul>
<li>Find = <code>&lt;li class="h6"&gt;(.*)&lt;/li&gt;</code></li>
<li>Replace = <code>&lt;h6&gt;$1&lt;/h6&gt;</code></li>
<li><code>☑ . matches newline</code> enabled</li>
</ul>
<p dir="auto">it will match the first <code>&lt;li ...&gt;</code> and the last <code>&lt;/li&gt;</code>, which is not what you want</p>
<p dir="auto">With</p>
<ul>
<li>Find = <code>&lt;li class="h6"&gt;(.*?)&lt;/li&gt;</code> – the <code>?</code> limits the <code>.*</code> to the smallest possible match</li>
<li>Replace = <code>&lt;h6&gt;$1&lt;/h6&gt;</code></li>
<li><code>☑ . matches newline</code> enabled</li>
</ul>
<p dir="auto">it will match each <code>&lt;li ...&gt;</code> and its paired <code>&lt;/li&gt;</code>, similar to the first example.</p>
<p dir="auto">Either the first or the third should work for you.</p>
<p dir="auto">This animation shows those three examples in practice, with the first and third working the way I think you want:</p>
<p dir="auto"><img src="https://camo.nodebb.org/de6dacd3c98db91b6ef00529789e3bdf15f9a0e2?url=https%3A%2F%2Fi.imgur.com%2FB6dxdO9.gif" alt="" class=" img-fluid img-markdown" /></p>
<p dir="auto">Please note that nested li will mess it up: for example, <code>&lt;li class="h6"&gt;blah &lt;li class="embeded"&gt;yada&lt;li&gt; blah&lt;/li&gt;</code> will <em>not</em> replace correctly.  Adding nesting to the regex will be nasty; if you need it, <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> should be able to help; otherwise, hopefully what I have will work for you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/48365</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/48365</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 07 Nov 2019 14:26:11 GMT</pubDate></item></channel></rss>