<?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[Search and replace question]]></title><description><![CDATA[<p dir="auto">Could you please help me with the following search-and-replace problem I am having?</p>
<p dir="auto">I am editing an html file and need to delete many of the hyperlinks.</p>
<p dir="auto">Here is the data I currently have (“before” data):</p>
<pre><code>&lt;a name="pgfId-659225"&gt;&lt;/a&gt;&lt;a name="TMS AEO alt_remote_control"&gt;&lt;/a&gt;&lt;a name="alt_remote_control"&gt;&lt;/a&gt;&lt;a name="TMS alt_remote_control"&gt;&lt;/a&gt;alt_remote_control&lt;/h6&gt;
</code></pre>
<p dir="auto">Here is how I would like that data to look (“after” data):</p>
<pre><code>&lt;a name="pgfId-659225"&gt;&lt;/a&gt;&lt;a name="alt_remote_control"&gt;&lt;/a&gt;&lt;a name="TMS alt_remote_control"&gt;&lt;/a&gt;alt_remote_control&lt;/h6&gt;
</code></pre>
<p dir="auto">In other words, I want to delete the hyperlink whose name begins with “TMS AEO” and leave the other hyperlinks on that line intact.</p>
<p dir="auto">To accomplish this, I have tried using the following Find/Replace expressions and settings</p>
<p dir="auto">Find What = <code>&lt;a name="TMS AEO .+&lt;/a&gt;</code><br />
Replace With = ``<br />
Search Mode = REGULAR EXPRESSION<br />
Dot Matches Newline = NOT CHECKED</p>
<p dir="auto">Unfortunately, this did not produce the output I desired, and I’m not sure why. It ended up selecting all of the hyperlinks on that line up to the last “&lt;/a&gt;”. Could you please help me understand what went wrong and help me find the solution?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/24698/search-and-replace-question</link><generator>RSS for Node</generator><lastBuildDate>Sat, 12 Sep 2026 16:44:24 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/24698.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 12 Jul 2023 13:21:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Search and replace question on Wed, 12 Jul 2023 14:04:56 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> That worked! Thank you very much.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/87849</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/87849</guid><dc:creator><![CDATA[Tom Dirks]]></dc:creator><pubDate>Wed, 12 Jul 2023 14:04:56 GMT</pubDate></item><item><title><![CDATA[Reply to Search and replace question on Wed, 12 Jul 2023 13:45:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tom-dirks" aria-label="Profile: Tom-Dirks">@<bdi>Tom-Dirks</bdi></a> said in <a href="/post/87847">Search and replace question</a>:</p>
<blockquote>
<pre><code>&lt;a name="TMS AEO .+&lt;/a&gt;
</code></pre>
<p dir="auto">Unfortunately, this did not produce the output I desired, and I’m not sure why. It ended up selecting all of the hyperlinks on that line up to the last “&lt;/a&gt;”</p>
</blockquote>
<p dir="auto">So very close!  Great job</p>
<p dir="auto">The <code>.+</code> is greedy, so it will match as many single characters as it can, which can include single characters that make up the hyperlinks between. If you make it non-greedy by adding a <code>?</code> to make that <code>.+?</code>, it will stop the match at the first <code>&lt;/a&gt;</code> instead of the last <code>&lt;/a&gt;</code>: Thus, <code>&lt;a name="TMS AEO .+?&lt;/a&gt;</code> should work for you</p>
<p dir="auto">-—</p>
<h3>Useful References</h3>
<ul>
<li><a href="https://npp-user-manual.org/docs/searching/#regular-expressions" rel="nofollow ugc">Notepad++ Online User Manual: Searching/Regex</a></li>
<li><a href="https://community.notepad-plus-plus.org/topic/15765/faq-desk-where-to-find-regular-expressions-regex-documentation">FAQ: Where to find other regular expressions (regex) documentation</a></li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/87848</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/87848</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 12 Jul 2023 13:45:10 GMT</pubDate></item></channel></rss>