<?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[regex s&#x2F;r for defined pattern while keeping some of the existing text]]></title><description><![CDATA[<p dir="auto">Hi all,</p>
<p dir="auto">After studying the Wiki as well as the Community forum I am still drawing a blank on my question.</p>
<p dir="auto">I receive loads of HTML files containing headlines marked in specific DIV containers.</p>
<p dir="auto">Example:<br />
&lt;div class=“head2”&gt;A headline text I need to keep&lt;/div&gt;<br />
&lt;div class=“head2”&gt;A different headline text which needs to stay&lt;/div&gt;<br />
&lt;div class=“head2”&gt;Even another headline we still need&lt;/div&gt;</p>
<p dir="auto">I need to mark them as h2, opening with &lt;h2&gt; and closing with &lt;/h2&gt; instead of the DIV tags.</p>
<p dir="auto">The files contain more div containers like just &lt;div&gt; or &lt;div class=“some_other_classname”&gt; which need to remain unchanged. Otherwise I’d just do a search and replace and would be done.</p>
<p dir="auto">I can still do that for the exclusively used opening tag, find &lt;div class=“head2”&gt; and replace with &lt;h2&gt;, but replacing &lt;/div&gt; with &lt;/h2&gt; would mess up all other lines where I need to keep the &lt;/div&gt;.</p>
<p dir="auto">Could you please tell me how I modify the example above to</p>
<p dir="auto">&lt;h2&gt;A headline text I need to keep&lt;/h2&gt;<br />
&lt;h2&gt;A different headline text which needs to stay&lt;/h2&gt;<br />
&lt;h2&gt;Even another headline we still need&lt;/h2&gt;</p>
<p dir="auto">***while leaving all other lines containing DIV tags unchanged ***?</p>
<p dir="auto">I’d really appreciate it! :o)</p>
<p dir="auto">Thanks<br />
Peter</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/11504/regex-s-r-for-defined-pattern-while-keeping-some-of-the-existing-text</link><generator>RSS for Node</generator><lastBuildDate>Sat, 06 Jun 2026 02:19:45 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/11504.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 23 Mar 2016 20:26:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to regex s&#x2F;r for defined pattern while keeping some of the existing text on Fri, 25 Mar 2016 22:35:48 GMT]]></title><description><![CDATA[<p dir="auto">Hello Peter,</p>
<p dir="auto">I’m not sure if the site you mentioned reflects the current state.<br />
I would advise to read <a href="http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html" rel="nofollow ugc">this</a> for searching<br />
and <a href="http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html" rel="nofollow ugc">that</a> for replacing.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/14922</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/14922</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Fri, 25 Mar 2016 22:35:48 GMT</pubDate></item><item><title><![CDATA[Reply to regex s&#x2F;r for defined pattern while keeping some of the existing text on Fri, 25 Mar 2016 16:30:39 GMT]]></title><description><![CDATA[<p dir="auto">I just tried it – it works perfectly fine and will save me tons of repetitive, boring and error-prone work in the future.</p>
<p dir="auto">With the solution you provided, I studied <a href="http://docs.notepad-plus-plus.org/index.php/Regular_Expressions" rel="nofollow ugc">http://docs.notepad-plus-plus.org/index.php/Regular_Expressions</a> again and start to understand which character does what in this combination. I would have never figured that out myself though without your help.</p>
<p dir="auto">Thanks again, Claudia! :o)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/14915</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/14915</guid><dc:creator><![CDATA[Peter Schrandt]]></dc:creator><pubDate>Fri, 25 Mar 2016 16:30:39 GMT</pubDate></item><item><title><![CDATA[Reply to regex s&#x2F;r for defined pattern while keeping some of the existing text on Thu, 24 Mar 2016 23:19:02 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">Enjoy the Easter holidays!</p>
</blockquote>
<p dir="auto">Thank you and I wsh you the same.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/14900</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/14900</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Thu, 24 Mar 2016 23:19:02 GMT</pubDate></item><item><title><![CDATA[Reply to regex s&#x2F;r for defined pattern while keeping some of the existing text on Thu, 24 Mar 2016 23:17:35 GMT]]></title><description><![CDATA[<p dir="auto">Claudia, thank you so much for your instant reply and helpful advice!<br />
I’ll try this as soon as I am back at the worksstation, it looks exactly as it will do the trick.</p>
<p dir="auto">Enjoy the Easter holidays! :o)<br />
Peter</p>
]]></description><link>https://community.notepad-plus-plus.org/post/14899</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/14899</guid><dc:creator><![CDATA[Peter Schrandt]]></dc:creator><pubDate>Thu, 24 Mar 2016 23:17:35 GMT</pubDate></item><item><title><![CDATA[Reply to regex s&#x2F;r for defined pattern while keeping some of the existing text on Wed, 23 Mar 2016 20:43:40 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/peter-schrandt" aria-label="Profile: Peter-Schrandt">@<bdi>Peter-Schrandt</bdi></a>,</p>
<p dir="auto">maybe the following regex could help</p>
<pre><code>find what:&lt;div class="head2"&gt;(.*)&lt;/div&gt;
replace with:&lt;h2&gt;\1&lt;/h2&gt;
</code></pre>
<p dir="auto">\1 holds the text between the div tags.<br />
If the head2 is also different than you might use</p>
<pre><code>&lt;div class=".*"&gt;(.*)&lt;/div&gt;
</code></pre>
<p dir="auto">instead.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/14864</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/14864</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Wed, 23 Mar 2016 20:43:40 GMT</pubDate></item></channel></rss>