<?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: Delete only one instance of a string between two html tags (double quotes)]]></title><description><![CDATA[<p dir="auto">hello. I have some html tags, for example:</p>
<p dir="auto"><code>&lt;meta name="description" content="......"/&gt;</code></p>
<p dir="auto">As you can see there are 2 double quotes <code>"</code> + <code>"</code> One at starting content of tag, one at the end content of that tag.</p>
<p dir="auto">But in the example below, I have one (or I cand have multiple double quotes, apart from the two basic. How can I delete those extra double quotes?</p>
<pre><code>&lt;meta name="description" content="Kiel vi rilatigas vian juĝvaloron "al la kredoj esprimitaj de aliaj se vi ne pretas elporti la kostojn de misinterpretado de la " cirkonstancoj en kiuj okazas evento?"/&gt;
</code></pre>
<p dir="auto">I try to use and old  generic regex that <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> made:</p>
<p dir="auto"><code>(?-si:BSR|(?!\A)\G)(?s-i:(?!ESR).)*?\K(?-si:FR)</code></p>
<p dir="auto">will become:</p>
<p dir="auto">FIND: <code>(?-si:&lt;meta name="description" content="|(?!\A)\G)(?s-i:(?!"/&gt;).)*?\K(?-si:")</code></p>
<p dir="auto">REPLACE BY: <code>(leave empty)</code></p>
<p dir="auto">The problem is that, this solution delete all double quotes, except the first one. But also, the last one (this did not have to be deleted)</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/23115/regex-delete-only-one-instance-of-a-string-between-two-html-tags-double-quotes</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 20:19:09 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/23115.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 14 Jun 2022 16:19:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Regex: Delete only one instance of a string between two html tags (double quotes) on Thu, 16 Jun 2022 06:51:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a></p>
<p dir="auto">I try myself to find a generic, from your regex. Works well, except doesn’t work for <code>"</code> (double quotes) because is repeated in the tag construction. I change those extra quotes on the content of tags, with a work, like “BOOM” and it find/replace it well beetween start and ending tag.</p>
<p dir="auto">These are the generic regex for your second solution. Are almost the same, short and long version. Makes the same thing, find and replace just well between start and ending tags.</p>
<p dir="auto"><strong><code>(?&lt;!=\x20)(?&lt;!=)FR(?!&gt;|ESR|\x20&gt;|\x20/&gt;|\?&gt;|\x20\?&gt;|BSR)</code></strong></p>
<p dir="auto"><strong>OR</strong></p>
<p dir="auto"><strong><code>(?&lt;!=\x20)(?&lt;!=)FR(?!&gt;|ESR|\x20&gt;|\x20/&gt;|\?&gt;|\x20\?&gt;|\x20BSR)</code></strong></p>
<p dir="auto"><strong>OR</strong></p>
<p dir="auto"><strong><code>(?&lt;!=\x20)(?&lt;!=)FR(?!&gt;|ESR|\x20\?&gt;|\x20BSR)</code></strong></p>
]]></description><link>https://community.notepad-plus-plus.org/post/77592</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/77592</guid><dc:creator><![CDATA[Robin Cruise]]></dc:creator><pubDate>Thu, 16 Jun 2022 06:51:01 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Delete only one instance of a string between two html tags (double quotes) on Wed, 15 Jun 2022 20:39:06 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7753">@robin-cruise</a>,</p>
<ul>
<li>
<p dir="auto">Regarding the <strong>first</strong> regex, your equivalent <strong>generic</strong> regex is <strong>correct</strong></p>
</li>
<li>
<p dir="auto">However, we <strong>cannot</strong> find any <strong>generic</strong> regex, related to my <strong>second</strong> regex ! Indeed, it just finds any <strong>double quote</strong> character when :</p>
<ul>
<li><strong>Some</strong> characters, before the <strong><code>"</code></strong> char, do <strong>not</strong> occur ( <strong><code>(?&lt;!=\x20)(?&lt;!=)</code></strong> )</li>
</ul>
</li>
<li>
<p dir="auto">AND</p>
<ul>
<li><strong>Some</strong> characters, after the <strong><code>"</code></strong> char, do <strong>not</strong> occur ( <strong><code>(?!&gt;|/&gt;|\x20&gt;|\x20/&gt;|\?&gt;|\x20\?&gt;|\x20\w+=)</code></strong> )</li>
</ul>
</li>
</ul>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/77577</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/77577</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 15 Jun 2022 20:39:06 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Delete only one instance of a string between two html tags (double quotes) on Wed, 15 Jun 2022 11:16:44 GMT]]></title><description><![CDATA[<p dir="auto">thank you <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a></p>
<p dir="auto"><code>(?-si:&lt;meta name="description" content="|(?!\A)\G).*?\K"(?!/&gt;)</code></p>
<p dir="auto">So, I extracted a new generic from your regex above:</p>
<p dir="auto">This is The Generic regex for search and replace:</p>
<p dir="auto"><strong><code>(?-si:BSR|(?!\A)\G).*?\KFR(?!ESR)</code></strong></p>
<p dir="auto">For the second regex you made, I also try to extract the generic, but I can’t figure it out…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/77553</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/77553</guid><dc:creator><![CDATA[Robin Cruise]]></dc:creator><pubDate>Wed, 15 Jun 2022 11:16:44 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Delete only one instance of a string between two html tags (double quotes) on Tue, 14 Jun 2022 19:56:03 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7753">@robin-Cruise</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/280">@neil-schipper</a> and <strong>All</strong>,</p>
<p dir="auto">Given this text :</p>
<pre><code class="language-html">&lt;meta name="description" content="Kiel vi rilatigas vian juĝvaloron "al la kredoj esprimitaj de aliaj se vi ne pretas elporti la kostojn de misinterpretado de la " cirkonstancoj en kiuj okazas evento?"/&gt;
</code></pre>
<p dir="auto">You used this regex :</p>
<p dir="auto">FIND: <strong><code>(?-si:&lt;meta name="description" content="|(?!\A)\G)(?s-i:(?!"/&gt;).)*?\K(?-si:")</code></strong></p>
<p dir="auto">So, <strong>after</strong> finding and deleting the two <strong>non</strong>-wanted <strong><code>"</code></strong> characters, then, due to the <strong><code>\G</code></strong> feature, it first selects the <strong>remaining</strong> range <strong><code>cirkonstancoj en kiuj okazas evento?</code></strong></p>
<p dir="auto">When reading the <strong>last</strong> char <strong><code>?</code></strong> of that range, the <strong><code>(?!"/&gt;)</code></strong> condition is <strong>still</strong> verified. So, due to the <strong><code>\K</code></strong> syntax, it <strong>wrongly</strong> selects the last <strong><code>"</code></strong> char !</p>
<p dir="auto">This case is <strong>special</strong> because the string to find is part of the <strong>ESR</strong> region too. The rule should be :</p>
<blockquote>
<p dir="auto">In <strong>single</strong> lines, containing the <strong><code>&lt;meta name="description" content="</code></strong> string, delete any subsequent <strong>double-quote</strong>, that is <strong>not ending</strong> the tag. This gives this simple regex :</p>
</blockquote>
<p dir="auto">SEARCH <strong><code>(?-si:&lt;meta name="description" content="|(?!\A)\G).*?\K"(?!/&gt;)</code></strong></p>
<p dir="auto">REPLACE <strong><code>Leave EMPTY</code></strong></p>
<p dir="auto">Note, that I keep only a <strong><code>No Single Line</code></strong> and <strong><code>Not Insensitive</code></strong> modifiers at <strong>beginning</strong> of the regex <strong><code>(?-si)</code></strong> and did <strong>not</strong> use any <strong>modifier</strong> afterwards, whereas you used this syntax <strong><code>.....(?s-i:(?!"/&gt;).)*?.....</code></strong></p>
<p dir="auto">Then, <strong>each</strong> time, the <strong><code>.+?</code></strong> represents the range of text to <strong>forget</strong> before catching the <strong><code>"</code></strong> char and the <strong>ESR</strong> region becomes the <strong>final negative</strong> look-ahead  <strong><code>(?!/&gt;)</code></strong></p>
<hr />
<p dir="auto">Now, the above regex S/R works <strong>only</strong> for lines containing <strong><code>&lt;meta name="description" content="</code></strong> Below, here is a regex which will find out any <strong>double-quote</strong>, between the usual <strong><code>"</code></strong> <strong>boundaries</strong>, in an <strong><code>HTML</code></strong> or <strong><code>XML</code></strong> file :</p>
<p dir="auto">SEARCH <strong><code>(?&lt;!=\x20)(?&lt;!=)"(?!&gt;|/&gt;|\x20&gt;|\x20/&gt;|\?&gt;|\x20\?&gt;|\x20\w+=)</code></strong></p>
<p dir="auto">Normally, this case should occur only in <strong>comments</strong> !</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/77550</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/77550</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 14 Jun 2022 19:56:03 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Delete only one instance of a string between two html tags (double quotes) on Tue, 14 Jun 2022 19:41:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/280">@neil-schipper</a> only those 2 double quotes (between dotes) are important:</p>
<p dir="auto"><code>&lt;meta name="description" content="......"/&gt;</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/77549</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/77549</guid><dc:creator><![CDATA[Robin Cruise]]></dc:creator><pubDate>Tue, 14 Jun 2022 19:41:40 GMT</pubDate></item><item><title><![CDATA[Reply to Regex: Delete only one instance of a string between two html tags (double quotes) on Tue, 14 Jun 2022 17:47:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7753">@robin-cruise</a></p>
<p dir="auto">Hard to understand.</p>
<p dir="auto">Try: "This regex produced the output <code>output1</code> but the output I want is <code>output2</code>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/77545</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/77545</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Tue, 14 Jun 2022 17:47:03 GMT</pubDate></item></channel></rss>