<?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[Massive list and massive search and replace?]]></title><description><![CDATA[<p dir="auto">I have multiple text files (over 100)</p>
<p dir="auto">and I need to do multiple replace text (a lot)</p>
<p dir="auto">example</p>
<ol>
<li>james - James</li>
<li>calvin - Calvin</li>
<li>new york - New York</li>
</ol>
<p dir="auto">is it possible to upload a list of text needs replacement (maybe Excel?) then search and replace?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/23638/massive-list-and-massive-search-and-replace</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 22:38:48 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/23638.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 20 Oct 2022 18:21:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Massive list and massive search and replace? on Tue, 11 Feb 2025 14:16:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a></p>
<p dir="auto">Many thanks for help</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99801</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99801</guid><dc:creator><![CDATA[Yurble Vương]]></dc:creator><pubDate>Tue, 11 Feb 2025 14:16:05 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Tue, 11 Feb 2025 12:04:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/34050">@Yurble-Vương</a> said :</p>
<blockquote>
<p dir="auto">Not work 2</p>
</blockquote>
<p dir="auto">This should work: <code>editor.rereplace(r'\b'+find_what+r'\b', replace_with)</code></p>
<p dir="auto">I like how you showed initiative in trying to solve the problem yourself…and you had the right idea, you just didn’t take it far enough.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99798</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99798</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 11 Feb 2025 12:04:02 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Mon, 10 Feb 2025 16:33:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a></p>
<p dir="auto">Sorry to ask and bother you. I tried to edit your py code as below, but it seems to be a wrong code. Could you advise how to correct:</p>
<p dir="auto">Not work:</p>
<pre><code>     # FINALLY, the actual replacement!
                editor.rereplace('\b'+find_what+'\b', replace_with)
</code></pre>
<p dir="auto">Not work 2:</p>
<pre><code>     # FINALLY, the actual replacement!
                editor.rereplace(r'\b'+find_what+'\b', replace_with)
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/99763</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99763</guid><dc:creator><![CDATA[Yurble Vương]]></dc:creator><pubDate>Mon, 10 Feb 2025 16:33:43 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Sun, 09 Feb 2025 17:16:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/34050">@Yurble-Vương</a> said in <a href="/post/99734">Massive list and massive search and replace?</a>:</p>
<blockquote>
<p dir="auto">how can I add in a code to made it change only words start or end a transition from space to non-space character</p>
</blockquote>
<p dir="auto">You can use <code>\b</code> in the regular expression to insist upon a word boundary; example: <code>\bapple</code> will match <code>have an apple today</code> but will not match <code>have a crabapple today</code>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99735</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99735</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 09 Feb 2025 17:16:17 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Sun, 09 Feb 2025 16:49:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a></p>
<p dir="auto">Thanks Alan, it work perfectly, Except one specially for me. Appreciate your help if possible:</p>
<p dir="auto">I want to find only within word boundary.</p>
<hr />
<p dir="auto">For example:<br />
<strong>Sentence:</strong>  You are eating apple. The tree have a lot of apples. all the apples is green.<br />
apple-&gt;cherry<br />
apples-&gt;cherries</p>
<hr />
<p dir="auto">Hence, how can I add in a code to made it change only words start or end a transition from space to non-space character (space, common, dot, quote marks, questions mark…).</p>
<p dir="auto">thanks in advance<br />
Yurble</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99734</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99734</guid><dc:creator><![CDATA[Yurble Vương]]></dc:creator><pubDate>Sun, 09 Feb 2025 16:49:29 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Tue, 11 Jun 2024 13:39:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a>  perfect!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/95375</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/95375</guid><dc:creator><![CDATA[nerdyone255]]></dc:creator><pubDate>Tue, 11 Jun 2024 13:39:48 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Sat, 08 Jun 2024 01:21:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/30982">@nerdyone255</a> said :</p>
<blockquote>
<p dir="auto">this script is FANTASTIC.</p>
</blockquote>
<p dir="auto">Well…glad you like it.</p>
<blockquote>
<p dir="auto">but i dont see where that would get printed- it doesnt show up in the python console either</p>
</blockquote>
<p dir="auto">The <code>self.print()</code> function calls are really meant as debug helpers while testing the script.  Thus, in the version of the script above, they don’t do anything because the <code>debug</code> variable is set to False.  If you change the <code>0</code> to a <code>1</code> in this line:</p>
<p dir="auto"><code>self.debug = True if 0 else False</code></p>
<p dir="auto">or simply change it to:</p>
<p dir="auto"><code>self.debug = True</code></p>
<p dir="auto">then the output of the self.print() calls will go to the PythonScript console window.  You’ll see the output you indicated you were interested, plus output from other things that happen while the script is running.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/95313</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/95313</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 08 Jun 2024 01:21:21 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Fri, 07 Jun 2024 16:26:08 GMT]]></title><description><![CDATA[<p dir="auto">this script is FANTASTIC.</p>
<p dir="auto">i do have a question though- in the final output it prints how many replacements were made, but is there any way to see what the actual replacements were?</p>
<p dir="auto">looking into the code i see</p>
<p dir="auto">“”" if self.num_repl_made_in_this_file &gt; 0:</p>
<pre><code>                self.print('replacing "{fw}" with "{rw}" {n} times'.format(
                    fw=find_what, rw=replace_with, n=self.num_repl_made_in_this_file)) """
</code></pre>
<p dir="auto">but i dont see where that would get printed- it doesnt show up in the python console either</p>
<p dir="auto">again huge thanks for this one</p>
]]></description><link>https://community.notepad-plus-plus.org/post/95294</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/95294</guid><dc:creator><![CDATA[nerdyone255]]></dc:creator><pubDate>Fri, 07 Jun 2024 16:26:08 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Wed, 26 Oct 2022 12:12:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26631">@Calvin-Foo</a> said in <a href="/post/80866">Massive list and massive search and replace?</a>:</p>
<blockquote>
<p dir="auto">I guess I need to learn from ground up.<br />
I guess I just start from thereI’ll further study from there and include a list of text (maybe import from CSV)</p>
</blockquote>
<p dir="auto">In case it isn’t obvious, you could take <em><strong>YOUR</strong></em> data, in whatever (textual) format, and use Notepad++ to change it with a replacement operation into <em><strong>MY</strong></em> demo format, and then just run with the demo solution.</p>
<p dir="auto">This avoids programming and could (probably) be made into a N++ macro for easy repetitive running.</p>
<p dir="auto">As an example, take your original problem statement data (I know it isn’t your real data, but we have none of that here, so…):</p>
<pre><code>1. james - James
2. calvin - Calvin
3. new york - New York
</code></pre>
<p dir="auto">You could change that into the needed input format for the script by this operation:</p>
<p dir="auto">Find: <code>(?-s)^\d+\. (.+?) - (.+)</code><br />
Replace: <code>${1}-&gt;${2}</code><br />
Search mode: <code>Regular expression</code><br />
Wrap around: Checked<br />
Action: <code>Replace All</code> button</p>
<p dir="auto">After the replace-all, your data would then look like this:</p>
<pre><code>james-&gt;James
calvin-&gt;Calvin
new york-&gt;New York
</code></pre>
<p dir="auto">which would be a direct feed-in to the demo script.</p>
<hr />
<blockquote>
<p dir="auto">this seems a bit too complicated for me</p>
</blockquote>
<p dir="auto">Of course, this data transform may involve learning some regular expressions (don’t know your expertise), but I don’t think it is too much to ask people that request a moderately-complex solution to a problem to do some sort of learning of their own along the way.</p>
<hr />
<blockquote>
<p dir="auto">How to write a simple replace text script?</p>
</blockquote>
<p dir="auto">Well about the simplest one I can think of would be a one-liner:</p>
<p dir="auto"><code>editor.replace('apple', 'Apple')</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/80873</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/80873</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 26 Oct 2022 12:12:39 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Wed, 26 Oct 2022 10:16:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26631">@Calvin-Foo</a></p>
<p dir="auto">There’s very, very, very little to learn. First, follow the instructions in Alan’s second post to you (“REFERENCE” link) LIKE A MONKEY.</p>
<p dir="auto">Here’s a first script you can run:</p>
<pre><code class="language-python">#! python
import sys
print "Old style print syntax"
sys.stdout.write("Calvin-Foo's first script -- hello from Python %s\n" % (sys.version,))
</code></pre>
<p dir="auto">You don’t need to know what any of the lines mean or what they do. (Once you get it running, you can hack at it for fun).</p>
<p dir="auto">There’s a lot complexity in airplanes and elevators and keyboards and phones that you don’t see and don’t need to deal with. It’s really quite similar.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/80867</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/80867</guid><dc:creator><![CDATA[Neil Schipper]]></dc:creator><pubDate>Wed, 26 Oct 2022 10:16:53 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Wed, 26 Oct 2022 09:02:25 GMT]]></title><description><![CDATA[<p dir="auto">I guess I need to learn from ground up.  I only have experience in writing ASP 3.0.  and SQL Server.</p>
<p dir="auto">I guess I just start from there</p>
<p dir="auto">Maybe anyone can give me a simple guide on How to write a simple replace text script?  I’ll further study from there and include a list of text (maybe import from CSV)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/80866</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/80866</guid><dc:creator><![CDATA[Calvin Foo]]></dc:creator><pubDate>Wed, 26 Oct 2022 09:02:25 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Tue, 25 Oct 2022 20:41:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26631">@Calvin-Foo</a> said in <a href="/post/80839">Massive list and massive search and replace?</a>:</p>
<blockquote>
<p dir="auto">Is it possible to simplify it just to read an Excel page, find A2 replace it with B2 for every text files are opened in NPP?</p>
</blockquote>
<p dir="auto">I suppose it IS possible, but not by me.<br />
The intent of the script was to solve kind of a general case problem, in a general way.<br />
Of course anyone can treat it as a demo, and feel free to modify it at will.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/80849</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/80849</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 25 Oct 2022 20:41:46 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Tue, 25 Oct 2022 20:40:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/12335">@Terry-R</a> said in <a href="/post/80843">Massive list and massive search and replace?</a>:</p>
<blockquote>
<p dir="auto">And whilst <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> has used a TSV (tab separated value) file</p>
</blockquote>
<p dir="auto">Actually it isn’t a “tab”, although I can see why you’d think that.  I chose <code>-</code> followed by <code>&gt;</code> as the delimiter.  The delimiter is specifically variable-ized in the script, so one could easily change it to whatever is desired.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/80848</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/80848</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 25 Oct 2022 20:40:22 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Tue, 25 Oct 2022 19:41:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26631">@Calvin-Foo</a> said in <a href="/post/80839">Massive list and massive search and replace?</a>:</p>
<blockquote>
<p dir="auto">Is it possible to simplify it just to read an Excel page, find A2 replace it with B2 for every text files are opened in NPP?</p>
</blockquote>
<p dir="auto">If you are referring to an Excel file with extension XLSX then no, Notepad++ does NOT read files which are binary in nature very well. It is after all a TEXT editor, not a Binary editor.</p>
<p dir="auto">However since you refer to an “Excel page” and refer to words in 2 columns, that could also be a CSV (comma separated value) file. And whilst <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> has used a TSV (tab separated value) file, the 2 are very similar. He possibly could alter his code to use the comma instead of a tab, but possibly used the tab to prevent possible confusion within words.</p>
<p dir="auto">But doing that minor change to his code isn’t going to simplify the process anyways. Just be thankful he has gone to such lengths to help you. Sometimes doing processes such as you outlined can be made easier, but will still require time to setup.</p>
<p dir="auto">Terry</p>
<p dir="auto">PS I see <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> has stated the same.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/80843</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/80843</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Tue, 25 Oct 2022 19:41:19 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Tue, 25 Oct 2022 19:45:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26631">@Calvin-Foo</a> ,</p>
<p dir="auto">Most of the complication is just setting up Python Script plugin and installing the script once.</p>
<p dir="auto">After that, you just have to <em>run</em> the script when you have a file</p>
<pre><code>blue-&gt;orange
replace this-&gt;with this
the delimiter is-&gt;a minus followed by a greater than
</code></pre>
<p dir="auto">It’s really not hard to create that substitution file.</p>
<p dir="auto">And having the replacement data in Excel would make it harder for Alan to write a script for you (and this forum is not a code-writing service), but because the script would still be written in PythonScript, you would still have to install PythonScript and install that script once.  Running it would be just as easy for you whether you run it with a text file as the source of the search-&gt;replace pairs or whether you run a script that has to parse some external Excel spreadsheet (easier, actually, for the text file, because then you don’t have to also run Excel just to prepare for a search-and-replace in Notepad++).  He would still have to have all those confirmation dialogs whether the map is in Excel or in Notepad++… and he’d also have to have another dialog which asks you where the Excel spreadsheet was.</p>
<p dir="auto">He wrote this not just for you, but also for all the other people who ask for nearly the same functionality (we’ve seen similar requests a lot over the years, and he finally decided that we needed one generic script to handle them all, so that we’d stop having to write customized scripts for each user).  If using this generic script is too complicated for you, you will not like any implementation that anyone here is able to give you.</p>
<p dir="auto">Good luck.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/80842</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/80842</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 25 Oct 2022 19:45:35 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Tue, 25 Oct 2022 19:25:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> Thanks, but wow, this seems a bit too complicated for me.<br />
Is it possible to simplify it just to read an Excel page, find A2 replace it with B2 for every text files are opened in NPP?</p>
<p dir="auto">I can just add new words in the excel file, then I just run the script</p>
]]></description><link>https://community.notepad-plus-plus.org/post/80839</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/80839</guid><dc:creator><![CDATA[Calvin Foo]]></dc:creator><pubDate>Tue, 25 Oct 2022 19:25:10 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Mon, 24 Oct 2022 14:13:32 GMT]]></title><description><![CDATA[<p dir="auto">Ok, so I found some time to finish the script.</p>
<p dir="auto">Here’s how it works:</p>
<p dir="auto">You start with a file open and active in Notepad++ that contains your desired replacements.  This file should be saved into the same folder in which you want to do the replacements.  The file can have any name and needs to have the following format for your replacements list:</p>
<pre><code>blue-&gt;orange
replace this-&gt;with this
the delimiter is-&gt;a minus followed by a greater than
</code></pre>
<p dir="auto">At that point, you run the script.  It will prompt you through a series of questions about the operation, giving you a chance to validate that you are doing what you intend at several steps:</p>
<p dir="auto"><img src="/assets/uploads/files/1666619883395-ce1880d1-2c1c-4d7a-a08d-bb6bc47aeca6-image.png" alt="ce1880d1-2c1c-4d7a-a08d-bb6bc47aeca6-image.png" class=" img-fluid img-markdown" /><br />
<img src="/assets/uploads/files/1666619862229-086558b9-38bc-486b-93f7-5418b0689635-image.png" alt="086558b9-38bc-486b-93f7-5418b0689635-image.png" class=" img-fluid img-markdown" /><br />
<img src="/assets/uploads/files/1666619845446-141bc6e6-2511-42b3-b8ec-bdd907bb318d-image.png" alt="141bc6e6-2511-42b3-b8ec-bdd907bb318d-image.png" class=" img-fluid img-markdown" /><br />
<img src="/assets/uploads/files/1666619796853-592c7ce0-5b52-42e7-812d-f6337b96daab-image.png" alt="592c7ce0-5b52-42e7-812d-f6337b96daab-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Somewhat obviously, after you give the final “Yes” the real work will actually be done and the indicated replacements made.</p>
<p dir="auto">I call the script <code>ReplaceInFilesFromListInActiveTab.py</code> and here is its listing:</p>
<pre><code># -*- coding: utf-8 -*-
from __future__ import print_function

# references:
#  https://community.notepad-plus-plus.org/topic/23638/massive-list-and-massive-search-and-replace
#  also possibly https://community.notepad-plus-plus.org/topic/22601
#  also possibly https://community.notepad-plus-plus.org/topic/22721
#  also possibly https://community.notepad-plus-plus.org/topic/23495

from Npp import *
import inspect
import os
import re
import glob

#-------------------------------------------------------------------------------

class RIFFLIAT(object):

    def __init__(self):

        self.debug = True if 0 else False
        if self.debug:
            console.show()
            console.clear()

        self.this_script_name = inspect.getframeinfo(inspect.currentframe()).filename.split(os.sep)[-1].rsplit('.', 1)[0]

        # the active tab has the list of the substitution pairs
        substitutions_list_file_path = notepad.getCurrentFilename()
        if not os.path.isfile(substitutions_list_file_path):
            self.mb('Substitution list file must be a hard-named file in the file system, i.e.,  not e.g. "new 2"')
            return
        self.print('substitutions_list_file_path:', substitutions_list_file_path)

        find_and_repl_match_list = []
        delimiter = '-&gt;'
        editor.research(r'(?-s)^(.+?)' + delimiter + r'(.+)', lambda m: find_and_repl_match_list.append((m.group(1), m.group(2))))
        if len(find_and_repl_match_list) == 0:
            self.mb('\r\n'.join([
                'The substitution list in the active file has no findwhat/replacewith pairs\r\n',
                'Format of file is, 1 pair per line, using  {d}  as a delimiter, no extra spaces:\r\n'.format(d=delimiter),
                'find1{d}replace1'.format(d=delimiter),
                'find2{d}replace2'.format(d=delimiter),
                '...{d}...'.format(d=delimiter),
                ]))
            return

        sample_repl_pairs_summary_list = []
        three_or_less_sub_pairs = min(3, len(find_and_repl_match_list))
        num_sub_pairs_above_3 = len(find_and_repl_match_list) - three_or_less_sub_pairs
        max_chars_show = 20
        for (find_what, replace_with) in find_and_repl_match_list[ 0 : three_or_less_sub_pairs ]:
            if len(find_what) &gt; max_chars_show: find_what = find_what[ 0 : max_chars_show] + '...'
            if len(replace_with) &gt; max_chars_show: replace_with = replace_with[ 0 : max_chars_show] + '...'
            sample_repl_pairs_summary_list.append('"{fw}" with "{rw}"'.format(fw=find_what, rw=replace_with))
        if num_sub_pairs_above_3 &gt; 0: sample_repl_pairs_summary_list.append('(and {} more)'.format(num_sub_pairs_above_3))

        search_folder_top_level_path = substitutions_list_file_path.rsplit(os.sep, 1)[0] + os.sep
        self.print('search_folder_top_level_path:', search_folder_top_level_path)

        if not self.yes_no('\r\n\r\n'.join([
                'Q1 of 4:\r\n',
                'Perform these replacements (specified in the active file content):',
                '\r\n'.join(sample_repl_pairs_summary_list) + '\r\n',
                'in the files in this folder?',
                search_folder_top_level_path,
                '-' * 60,
                'IT IS STRONGLY SUGGESTED TO MAKE A BACKUP',
                'OF ALL SOURCE FILES BEFORE RUNNING THIS!',
                ])):
            return

        process_subfolders = self.yes_no_cancel('\r\n\r\n'.join([
            'Q2 of 4:\r\n',
            'Do replacements in files in SUBFOLDERS of this folder also?',
            search_folder_top_level_path,
            ]))
        if process_subfolders == None: return  # user cancel
        self.print('process_subfolders:', process_subfolders)

        default_filespec = '*.txt'
        filter_input = self.prompt(
            'Q3 of 4:\r\n' + \
            'Supply filespec filter list         (example:    *.html *.txt *.log    )',
            default_filespec)
        if filter_input == None: return  # user cancel
        filters_list = filter_input.split(' ')
        filters_list = [ f for f in filters_list if len(f) &gt; 0 ]  # remove any empty entries in filters_list
        self.print('filters_list:', filters_list)

        pathnames_of_files_to_replace_in_list = []
        for (root, dirs, files) in os.walk(search_folder_top_level_path):
            for filt in filters_list:
                for p in glob.glob(os.path.join(root, filt)):
                    if p != substitutions_list_file_path:
                        pathnames_of_files_to_replace_in_list.append(p)
            if not process_subfolders: break
        if len(pathnames_of_files_to_replace_in_list) == 0:
            self.mb('No files matched specified filter(s)')
            return

        num_files_to_examine = len(pathnames_of_files_to_replace_in_list)

        if not self.yes_no('\r\n\r\n'.join([
                'Q4 of 4:\r\n',
                '---- FINAL CONFIRM ----\r\n',
                'Make replacements in {nfe} candidate files in this folder{b} ?'.format(
                    nfe=num_files_to_examine,
                    b=' AND below' if process_subfolders else '\r\n(but not its subfolders)'),
                search_folder_top_level_path,
                ])):
            return

        pathname_currently_open_in_a_tab_list = []
        for (pathname, buffer_id, index, view) in notepad.getFiles():
            if pathname not in pathname_currently_open_in_a_tab_list:
                pathname_currently_open_in_a_tab_list.append(pathname)

        num_repl_made_in_all_files = 0
        pathnames_with_content_changed_by_repl_list = []

        for pathname in pathnames_of_files_to_replace_in_list:

            if pathname in pathname_currently_open_in_a_tab_list:
                self.print('switching active tab to', pathname)
                notepad.activateFile(pathname)
                editor.beginUndoAction()
            else:
                self.print('opening', pathname)
                notepad.open(pathname)
            if notepad.getCurrentFilename() != pathname: continue  # shouldn't happen

            for (find_what, replace_with) in find_and_repl_match_list:

                # since the editor.replace() function won't tell us how many replacements it made,
                #  count them by searching for the matches BEFORE doing the replacement
                self.num_repl_made_in_this_file = 0
                def match_found(m): self.num_repl_made_in_this_file += 1
                editor.search(find_what, match_found)

                if self.num_repl_made_in_this_file &gt; 0:

                    self.print('replacing "{fw}" with "{rw}" {n} times'.format(
                        fw=find_what, rw=replace_with, n=self.num_repl_made_in_this_file))

                    num_repl_made_in_all_files += self.num_repl_made_in_this_file

                    if pathname not in pathnames_with_content_changed_by_repl_list:
                        pathnames_with_content_changed_by_repl_list.append(pathname)

                    # FINALLY, the actual replacement!
                    editor.replace(find_what, replace_with)

            if pathname in pathname_currently_open_in_a_tab_list:
                editor.endUndoAction()
            else:
                if editor.getModify():
                    self.print('saving', pathname)
                    notepad.save()
                self.print('closing', pathname)
                notepad.close()

        # restore tab that was active before we started
        notepad.activateFile(substitutions_list_file_path)

        self.mb('\r\n\r\n'.join([
            '---- DONE! ----',
            '{nr} total replacements made in {nrf} files'.format(nr=num_repl_made_in_all_files,
                nrf=len(pathnames_with_content_changed_by_repl_list)),
            '(of {nfe} files matching filters provided)'.format(nfe=num_files_to_examine),
            ]))

    def print(self, *args):
        if self.debug:
            print('RIFFLIAT:', *args)

    def mb(self, msg, flags=0, title=''):  # a message-box function
        return notepad.messageBox(msg, title if title else self.this_script_name, flags)

    def yes_no(self, question_text):
        retval = False
        answer = self.mb(question_text, MESSAGEBOXFLAGS.YESNO, self.this_script_name)
        return True if answer == MESSAGEBOXFLAGS.RESULTYES else False

    def yes_no_cancel(self, question_text):
        retval = None
        answer = self.mb(question_text, MESSAGEBOXFLAGS.YESNOCANCEL, self.this_script_name)
        if answer == MESSAGEBOXFLAGS.RESULTYES: retval = True
        elif answer == MESSAGEBOXFLAGS.RESULTNO: retval = False
        return retval

    def prompt(self, prompt_text, default_text=''):
        if '\n' not in prompt_text: prompt_text = '\r\n' + prompt_text
        prompt_text += ':'
        return notepad.prompt(prompt_text, self.this_script_name, default_text)

#-------------------------------------------------------------------------------

if __name__ == '__main__': RIFFLIAT()
</code></pre>
<p dir="auto">For basic information about setting up scripting, see the REFERENCE I provided in an earlier post in this thread.</p>
<p dir="auto">(And BTW, thanks to <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> for some prerelease testing on this!)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/80813</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/80813</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 24 Oct 2022 14:13:32 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Thu, 20 Oct 2022 19:30:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> it will be great if you can help me on this. TQVM</p>
]]></description><link>https://community.notepad-plus-plus.org/post/80740</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/80740</guid><dc:creator><![CDATA[Calvin Foo]]></dc:creator><pubDate>Thu, 20 Oct 2022 19:30:44 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Thu, 20 Oct 2022 19:20:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26631">@Calvin-Foo</a> said in <a href="/post/80738">Massive list and massive search and replace?</a>:</p>
<blockquote>
<p dir="auto">I didnt know Notepad++ can do Scripting</p>
</blockquote>
<p dir="auto">Yes, here’s a good starting point <a href="https://community.notepad-plus-plus.org/topic/23039/faq-desk-how-to-install-and-run-a-script-in-pythonscript/1">REFERENCE</a>.</p>
<p dir="auto">If you can give me a little time, I’ll put together a demo in my upcoming spare time.  We have some scripts here on this site for “replacing from a list” but I don’t think we have anything that operates over a folder tree of files.  I could pull together something that does both.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/80739</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/80739</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 20 Oct 2022 19:20:24 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Thu, 20 Oct 2022 19:16:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> I dont mind a little scripting. But I didnt know Notepad++ can do Scripting</p>
]]></description><link>https://community.notepad-plus-plus.org/post/80738</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/80738</guid><dc:creator><![CDATA[Calvin Foo]]></dc:creator><pubDate>Thu, 20 Oct 2022 19:16:11 GMT</pubDate></item><item><title><![CDATA[Reply to Massive list and massive search and replace? on Thu, 20 Oct 2022 18:59:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26631">@Calvin-Foo</a></p>
<p dir="auto">There really isn’t a native-to-Notepad++ way of doing this.<br />
If you’re willing to use a scripting plugin, though, we can “get 'er done” – how about it? Are you willing to go to the “complication” of setting up scripting?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/80736</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/80736</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 20 Oct 2022 18:59:22 GMT</pubDate></item></channel></rss>