<?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 selective replace]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">I’m hoping someone can help as I’ve been struggling with this all day!</p>
<p dir="auto">I have some text files that I want to do some search/replace on but I can’t work out how to reference selectively what I’m trying to replace.</p>
<p dir="auto">Taking this as the test:</p>
<pre><code>IF Thirty THEN
DRAW("               Twenty, Thirty, Forty, Fifty")
ENDIF
</code></pre>
<p dir="auto">I would like to replace the Thirty on line that includes DRAW with ‘30’ but not on the IF line. How can I do this please.</p>
<p dir="auto">I’m tearing my hair out!</p>
<p dir="auto">Many thanks</p>
<p dir="auto">Rob</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/19704/regex-selective-replace</link><generator>RSS for Node</generator><lastBuildDate>Mon, 14 Sep 2026 08:37:13 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/19704.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 14 Jul 2020 15:43:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to RegEx selective replace on Tue, 14 Jul 2020 16:42:05 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/55860">RegEx selective replace</a>:</p>
<blockquote>
<p dir="auto">(?-s)(DRAW.*)Thirty</p>
</blockquote>
<p dir="auto">Many thanks!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/55868</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/55868</guid><dc:creator><![CDATA[Forum Bloke]]></dc:creator><pubDate>Tue, 14 Jul 2020 16:42:05 GMT</pubDate></item><item><title><![CDATA[Reply to RegEx selective replace on Tue, 14 Jul 2020 15:50:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/forum-bloke" aria-label="Profile: Forum-Bloke">@<bdi>Forum-Bloke</bdi></a> ,</p>
<ul>
<li>FIND WHAT = <code>(?-s)(DRAW.*)Thirty</code></li>
<li>REPLACE WITH = <code>$1Replacement</code></li>
<li>MODE = regular expression</li>
</ul>
<p dir="auto">Requires <code>DRAW</code> to come before the <code>Thirty</code>, on the same line.</p>
<ul>
<li><code>(?-s)</code> = dot wildcard does not match space</li>
<li><code>(DRAW.*)</code> = literal text <code>DRAW</code> followed by 0 or more characters (<code>.*</code>), all put into group#1</li>
<li><code>Thirty</code> = literal text you want to replace</li>
<li><code>$1</code> = in the replacement, this will include the contents of group#1, which is everything from <code>DRAW</code> (including the <code>DRAW</code>) to just before the <code>Thirty</code></li>
<li><code>Replacement</code> = the word you want to insert instead of <code>Thirty</code></li>
</ul>
<p dir="auto">-—<br />
Official Notepad++ Searching/Regex Docs = <a href="https://npp-user-manual.org/docs/searching/#regular-expressions" rel="nofollow ugc">https://npp-user-manual.org/docs/searching/#regular-expressions</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/55860</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/55860</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 14 Jul 2020 15:50:29 GMT</pubDate></item></channel></rss>