<?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[Multiple word search and replace within a  range start with xxx and end with yyy]]></title><description><![CDATA[<p dir="auto">I have already read  from <a href="https://stackoverflow.com/questions/11389466/multiple-word-search-and-replace-in-notepad" rel="nofollow ugc">this</a> and know that I can do Multiple word search and replace within a file by<br />
Install Python Script plugin from Plugin Manager.<br />
Create a file with your substitutions (e.g., C:/Temp/Substitutions.txt), separate values with space:</p>
<pre><code>good bad
great worse
fine not
</code></pre>
<p dir="auto">Create a new script:</p>
<pre><code>with open('C:/Temp/Substitutions.txt') as f:
    for l in f:
        s = l.split()
        editor.replace(s[0], s[1])
Run the new script against the text you want to substitute.
</code></pre>
<p dir="auto">However, there are multiple objects in the file, and I just want to change the string within certain objects for example:</p>
<pre><code>object={
...
type=1
b={
abc= 123
def = 456
ghi=789
}
}

object={
...
type=2
b={
abc= 987
bbb = 654
ccc=321
}
}

object={
...
type=3
b={
abc= 000
fed = 001
ihg=002
}
}

object={
...
type=2
b={
abc= 987
bbb = 654
ccc=321
}
}
</code></pre>
<p dir="auto">I just want to change every “abc” from every type 2 object.<br />
Is it possible to write a script that the program would start replacing at " type=2" and end at “}” for the whole file?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/20116/multiple-word-search-and-replace-within-a-range-start-with-xxx-and-end-with-yyy</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Jul 2026 05:01:47 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/20116.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Oct 2020 19:53:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Multiple word search and replace within a  range start with xxx and end with yyy on Wed, 07 Oct 2020 22:02:27 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/wagner-leung" aria-label="Profile: wagner-leung">@<bdi>wagner-leung</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">My bad ! So, if I interpret your <strong>intended</strong> result, <strong>strictly</strong>, the <strong>regex</strong> S/R becomes :</p>
<p dir="auto">SEARCH <strong><code>(?s)object((?!object).)+?type=2((?!object).)+?\K\babc(?=\h*=)</code></strong></p>
<p dir="auto">REPLACE <strong><code>**aaa**</code></strong></p>
<p dir="auto">Hope this version is the <strong>good</strong> one !  Of course, you may <strong>change</strong> the line <strong><code>type=2</code></strong> and/or the variable <strong><code>abc</code></strong> as you like !</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> :</p>
<p dir="auto">An other formulation of the <strong>search</strong> regex, using the <strong>free-spacing</strong> mode <strong><code>(?x)</code></strong> , would be :</p>
<p dir="auto">SEARCH <strong><code>(?xs)  object  ((?!object).)+?  type=2  ((?!object).)+?  \K\b  abc  (?=\h*=)</code></strong></p>
<p dir="auto">For instance, the <strong>following</strong> search regex would search for the variable <strong><code>abc</code></strong>, in any <strong><code>object</code></strong> block containing, either, the line  <strong><code>type=2</code></strong> or <strong><code>type=3</code></strong></p>
<p dir="auto">SEARCH <strong><code>(?xs)  object  ((?!object).)+?  type=[23]  ((?!object).)+?  \K\b  abc  (?=\h*=)</code></strong></p>
]]></description><link>https://community.notepad-plus-plus.org/post/58361</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58361</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 07 Oct 2020 22:02:27 GMT</pubDate></item><item><title><![CDATA[Reply to Multiple word search and replace within a  range start with xxx and end with yyy on Wed, 07 Oct 2020 21:21:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a><br />
I want to change the variable abc but not the string.<br />
As this is another coding language string integer does not make any difference.</p>
<p dir="auto">Here is the intended result</p>
<pre><code>object={
...
type=1
b={
abc= 123
def = 456
ghi=789
}
}

object={
...
type=2
b={
**aaa**= 987
bbb = 654
ccc=321
}
}

object={
...
type=3
b={
abc= 000
fed = 001
ihg=002
}
}

object={
...
type=2
b={
**aaa**= 987
bbb = 654
ccc=321
}
}
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/58360</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58360</guid><dc:creator><![CDATA[Wagner Leung]]></dc:creator><pubDate>Wed, 07 Oct 2020 21:21:35 GMT</pubDate></item><item><title><![CDATA[Reply to Multiple word search and replace within a  range start with xxx and end with yyy on Wed, 07 Oct 2020 21:10:40 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/wagner-leung" aria-label="Profile: wagner-leung">@<bdi>wagner-leung</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">Ah OK ! So the variable <strong><code>abc</code></strong> contains the <strong>string</strong> <strong><code>123</code></strong>. However my reasoning remains <strong>identical</strong> :</p>
<p dir="auto">I supposed that you want to change the string <strong><code>987</code></strong> of the variable <strong>abc</strong>, when inside an <strong>object</strong> block, containing the line <strong><code>Type = 2</code></strong>, by any <strong>personal</strong> string, inserted in the <strong>Replace</strong> zone !</p>
<p dir="auto">A <strong>better</strong> regex, which catches <strong>any</strong> value of the variable <strong><code>abc</code></strong>, would be :</p>
<p dir="auto">SEARCH <strong><code>(?s)object((?!object).)+?type=2.+?abc=\x20\K.+?$</code></strong></p>
<p dir="auto">May be, the best would be to show us a piece of your <strong>initial</strong> text and your <strong>final expected</strong> text ! to verify if we’re speaking about the <strong>same</strong> thing :-)</p>
<p dir="auto">See you later !</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58359</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58359</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 07 Oct 2020 21:10:40 GMT</pubDate></item><item><title><![CDATA[Reply to Multiple word search and replace within a  range start with xxx and end with yyy on Wed, 07 Oct 2020 20:52:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/wagner-leung" aria-label="Profile: Wagner-Leung">@<bdi>Wagner-Leung</bdi></a></p>
<p dir="auto">So it is a very common problem here that people don’t provide BEFORE and AFTER data examples.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> assumed that you were interested in the number <em>after</em> <code>abc=</code> when it appears (I think) that you are more interested in the <code>abc</code> itself.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58358</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58358</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 07 Oct 2020 20:52:27 GMT</pubDate></item><item><title><![CDATA[Reply to Multiple word search and replace within a  range start with xxx and end with yyy on Wed, 07 Oct 2020 20:38:11 GMT]]></title><description><![CDATA[<p dir="auto">abc is string</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> said in <a href="/post/58356">Multiple word search and replace within a range start with xxx and end with yyy</a>:</p>
<blockquote>
<p dir="auto">REPLACE Your Integer !</p>
</blockquote>
]]></description><link>https://community.notepad-plus-plus.org/post/58357</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58357</guid><dc:creator><![CDATA[Wagner Leung]]></dc:creator><pubDate>Wed, 07 Oct 2020 20:38:11 GMT</pubDate></item><item><title><![CDATA[Reply to Multiple word search and replace within a  range start with xxx and end with yyy on Wed, 07 Oct 2020 20:21:29 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/wagner-leung" aria-label="Profile: wagner-leung">@<bdi>wagner-leung</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">I can’t give you <strong>advices</strong> about a <strong>Python</strong> script solution but this <strong>regex</strong> S/R seems to work nice :</p>
<ul>
<li>SEARCH <strong><code>(?s)object((?!object).)+?type=2(.+?)abc=\x20\K987</code></strong></li>
</ul>
<p dir="auto">or</p>
<ul>
<li>
<p dir="auto">SEARCH <strong><code>(?s)object((?!object).)+?type=2(.+?)abc=\x20\K\d+</code></strong>    if you’re looking for <strong>any integer</strong> value fore <strong><code>abc</code></strong></p>
</li>
<li>
<p dir="auto">REPLACE <strong><code>Your Integer !</code></strong></p>
</li>
<li>
<p dir="auto">Tick the <strong><code>Wrap around</code></strong> option</p>
</li>
<li>
<p dir="auto">Select the <strong><code>Regular expression</code></strong> search mode</p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Replace All</code></strong> button</p>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/58356</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/58356</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 07 Oct 2020 20:21:29 GMT</pubDate></item></channel></rss>