<?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[Are there any plugins or ways to perform multiple search and replace regex operations at once?]]></title><description><![CDATA[<p dir="auto">Are there any plugins or ways to perform multiple search and replace operations at once?</p>
<p dir="auto">Let’s say I have several FIND and REPLACE regex operations. But I don’t have time to run each one. I would like to put each operation in order, then run the program once (and the program will run them in the order I put them).</p>
<p dir="auto">Is it possible? Has anyone thought about this?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/22601/are-there-any-plugins-or-ways-to-perform-multiple-search-and-replace-regex-operations-at-once</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 03:01:07 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/22601.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 20 Feb 2022 18:35:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Are there any plugins or ways to perform multiple search and replace regex operations at once? on Sun, 10 Apr 2022 15:00:18 GMT]]></title><description><![CDATA[<p dir="auto">Done. If someone wants to make search and replace with Python Script, in a directory:</p>
<pre><code># -*- coding: utf-8 -*-
from __future__ import print_function

from Npp import *
import os
import sys

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

class T22601(object):

    def __init__(self):
        Path="C:\\python-test"
        for root, dirs, files in os.walk(Path):
            nested_levels = root.split('/')
            if len(nested_levels) &gt; 0:
                del dirs[:]
            for filename in files:		
                if filename[-5:] == '.html':
                    notepad.open(root + "\\" + filename)
                    console.write(root + "\\" + filename + "\r\n")
                    notepad.runMenuCommand("Encodage", "Convertir en UTF-8")
                    regex_find_repl_dict_list = [
                        { 'find' : r'foo', 'replace' : r'bar' },
                        { 'find' : r'bar', 'replace' : r'gaga' },
                    ]
                    editor.beginUndoAction()
                    for d in regex_find_repl_dict_list: editor.rereplace(d['find'], d['replace'])
                    editor.endUndoAction()
                    notepad.save()
                    notepad.close()
#-------------------------------------------------------------------------------

if __name__ == '__main__': T22601()
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/75920</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75920</guid><dc:creator><![CDATA[rodica F]]></dc:creator><pubDate>Sun, 10 Apr 2022 15:00:18 GMT</pubDate></item><item><title><![CDATA[Reply to Are there any plugins or ways to perform multiple search and replace regex operations at once? on Mon, 21 Feb 2022 10:00:20 GMT]]></title><description><![CDATA[<p dir="auto">One way such a thing can be implemented is shown <a href="https://community.notepad-plus-plus.org/post/22135">here</a>, for example.</p>
<p dir="auto">In order to use the editor’s methods, each of the files <strong>must be</strong> loaded, otherwise scintilla, the underlying component to which the editor object refers, has no way of accessing the text content to perform, for example, the searches.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74437</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74437</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Mon, 21 Feb 2022 10:00:20 GMT</pubDate></item><item><title><![CDATA[Reply to Are there any plugins or ways to perform multiple search and replace regex operations at once? on Mon, 21 Feb 2022 08:09:52 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>
<blockquote>
<p dir="auto">The OP didn’t say anything about multiple files, just multiple operations.  Consequently, the script doesn’t consider multiple files.</p>
</blockquote>
<p dir="auto">yes, indeed. Good point of view. It forgot to mention. How can I make multiple files and replace, in a folder with many text files?</p>
<p dir="auto">This will be a great solution, will help a lot.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74434</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74434</guid><dc:creator><![CDATA[Hellena Crainicu]]></dc:creator><pubDate>Mon, 21 Feb 2022 08:09:52 GMT</pubDate></item><item><title><![CDATA[Reply to Are there any plugins or ways to perform multiple search and replace regex operations at once? on Sun, 20 Feb 2022 21:38:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/21856">@hellena-crainicu</a> said in <a href="/post/74425">Are there any plugins or ways to perform multiple search and replace regex operations at once?</a>:</p>
<blockquote>
<p dir="auto">Only in Notepad++ or Sublime Text or GrepWin works all regex operators and formulas.</p>
</blockquote>
<p dir="auto">I presume that if that is true then all of these use the Boost regex engine.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74429</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74429</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 20 Feb 2022 21:38:04 GMT</pubDate></item><item><title><![CDATA[Reply to Are there any plugins or ways to perform multiple search and replace regex operations at once? on Sun, 20 Feb 2022 21:34:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/21856">@hellena-crainicu</a> said in <a href="/post/74425">Are there any plugins or ways to perform multiple search and replace regex operations at once?</a>:</p>
<blockquote>
<p dir="auto">Or it works for a general Python platform?</p>
</blockquote>
<p dir="auto">The code is definitely tied to PythonScript, not a “general Python platform”.<br />
Otherwise it would be off-topic for this forum.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74428</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74428</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 20 Feb 2022 21:34:16 GMT</pubDate></item><item><title><![CDATA[Reply to Are there any plugins or ways to perform multiple search and replace regex operations at once? on Sun, 20 Feb 2022 21:31:25 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> said in <a href="/post/74426">Are there any plugins or ways to perform multiple search and replace regex operations at once?</a>:</p>
<blockquote>
<p dir="auto">how can your script/code be used if someone want to change many text files from one folder? Don’t I have to put the directory path somewhere?</p>
</blockquote>
<p dir="auto">The OP didn’t say anything about multiple files, just multiple operations.  Consequently, the script doesn’t consider multiple files.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74427</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74427</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 20 Feb 2022 21:31:25 GMT</pubDate></item><item><title><![CDATA[Reply to Are there any plugins or ways to perform multiple search and replace regex operations at once? on Sun, 20 Feb 2022 21:23:08 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">how can your script/code be used if someone want to change many text files from one folder? Don’t I have to put the directory path somewhere?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74426</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74426</guid><dc:creator><![CDATA[Robin Cruise]]></dc:creator><pubDate>Sun, 20 Feb 2022 21:23:08 GMT</pubDate></item><item><title><![CDATA[Reply to Are there any plugins or ways to perform multiple search and replace regex operations at once? on Sun, 20 Feb 2022 21:10:55 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> thank you.</p>
<p dir="auto">Is this code working only for <code>Notepad++ -&gt; Menu -&gt; Plugins -&gt; Python Script ?</code></p>
<p dir="auto">Or it works for a general Python platform?</p>
<p dir="auto">Because, for usual Python platform some regex operators such as <code>\K</code> or <code>\A</code> …and many other combination of formulas, doesn’t work.</p>
<p dir="auto">Only in <strong>Notepad++</strong> or <strong>Sublime Text</strong> or <strong>GrepWin</strong> works all regex operators and formulas.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/74425</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74425</guid><dc:creator><![CDATA[Hellena Crainicu]]></dc:creator><pubDate>Sun, 20 Feb 2022 21:10:55 GMT</pubDate></item><item><title><![CDATA[Reply to Are there any plugins or ways to perform multiple search and replace regex operations at once? on Sun, 20 Feb 2022 19:01:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/21856">@hellena-crainicu</a></p>
<p dir="auto">It’s not difficult, if you’re willing to take the leap to scripting.</p>
<p dir="auto">For example, here’s some PythonScript code that does what you ask for:</p>
<pre><code># -*- coding: utf-8 -*-
from __future__ import print_function

from Npp import *

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

class T22601(object):

    def __init__(self):
        regex_find_repl_dict_list = [
            { 'find' : r'foo', 'replace' : r'bar' },
            { 'find' : r'fu', 'replace' : r'bar' },
        ]
        editor.beginUndoAction()
        for d in regex_find_repl_dict_list: editor.rereplace(d['find'], d['replace'])
        editor.endUndoAction()

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

if __name__ == '__main__': T22601()
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/74421</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/74421</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 20 Feb 2022 19:01:34 GMT</pubDate></item></channel></rss>