<?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[pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others?]]></title><description><![CDATA[<p dir="auto">I use pythonscript, but I am not much conversant with its coding so I could do just simple macro and not make complex script so far.</p>
<p dir="auto">I have about 10 tables in which one set of regex/ phrases are to be replaced with other regex/ phrase, given correspondingly in the table itself.</p>
<p dir="auto">frankly, I am using foxreplace in firefox to do so, and it is working.</p>
<p dir="auto">tables are huge, some have 1000s of such phrases, and those 4-5 tables are to be replaced one after another on the same data.</p>
<p dir="auto">And the content of those tables change almost daily.</p>
<p dir="auto">I don’t think it will be possible to create py script for all of those regex/ phrases. That is not the way of programming, as I see it, those phrases are data, and there should be a script that picks data from those tables and does the replacement.</p>
<p dir="auto">Is there any such ready script that will read data from csv txt file and does the replacement, also include other option for replacement like fullwordmatch and casematch.</p>
<p dir="auto">Actually, I am looking for a script that does what foxreplace does.</p>
<p dir="auto">Please guide.</p>
<p dir="auto">Thanks a gig.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/16942/pythonscript-any-ready-pyscript-to-replace-one-huge-set-of-regex-phrases-with-others</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Jul 2026 13:25:53 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/16942.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 13 Jan 2019 19:34:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Mon, 13 Feb 2023 08:05:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a><br />
I see… 😅</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84101</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84101</guid><dc:creator><![CDATA[Mayonnaisu]]></dc:creator><pubDate>Mon, 13 Feb 2023 08:05:33 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Mon, 13 Feb 2023 07:58:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mayonnaisu" aria-label="Profile: Mayonnaisu">@<bdi>Mayonnaisu</bdi></a></p>
<p dir="auto">The error message indicates that you need <strong>more</strong> variables.<br />
If you need less, then the error message would be slightly different, something like <em>need more than 2 values to unpack</em>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84100</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84100</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Mon, 13 Feb 2023 07:58:44 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Mon, 13 Feb 2023 06:55:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a><br />
I see that’s how it is. So I just need to delete the (third) variable that I don’t need. Thanks for the information!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84099</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84099</guid><dc:creator><![CDATA[Mayonnaisu]]></dc:creator><pubDate>Mon, 13 Feb 2023 06:55:27 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Sun, 12 Feb 2023 10:06:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mayonnaisu" aria-label="Profile: Mayonnaisu">@<bdi>Mayonnaisu</bdi></a></p>
<p dir="auto">If you get an error message like <strong>ValueError: too many values to unpack</strong>, then this is a strong indication that you have generated too many values :-) - I mean, what is wrong with this message?<br />
Consider the following: “(a, b) = ‘A B C’.split()”<br />
From the code, you expect the split to generate <code>TWO</code> results that you want to put into variables a and b, but that’s not the case, is it?<br />
So your real data does not match your code logic.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84087</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84087</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Sun, 12 Feb 2023 10:06:42 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Sun, 12 Feb 2023 05:32:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gokul-gopalakrishnan" aria-label="Profile: Gokul-Gopalakrishnan">@<bdi>Gokul-Gopalakrishnan</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a><br />
Me too…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84085</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84085</guid><dc:creator><![CDATA[Mayonnaisu]]></dc:creator><pubDate>Sun, 12 Feb 2023 05:32:21 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Sat, 22 Jan 2022 19:40:58 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> I’m getting this following error when I try to run this script.<br />
Traceback (most recent call last):<br />
File “C:\Program Files\Notepad++\plugins\PythonScript\scripts\Samples\Multiples_SR.py”, line 96, in &lt;module&gt;<br />
(s,r,e) = line[1:].rstrip(‘\n’).split(line[0])<br />
ValueError: too many values to unpack</p>
<p dir="auto">SR_List:<br />
‘%(\hpc-nas.noise.server01.net)%(/Volumes)%’,</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73162</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73162</guid><dc:creator><![CDATA[Gokul Gopalakrishnan]]></dc:creator><pubDate>Sat, 22 Jan 2022 19:40:58 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Mon, 28 Jan 2019 13:26:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/v-s-rawat" aria-label="Profile: V-S-Rawat">@<bdi>V-S-Rawat</bdi></a></p>
<p dir="auto">Just to say a bit more, adding onto what Eko said:</p>
<p dir="auto">If you have Pythonscript installed with N++, it is run from a python.dll.  If you have no other external Python installed (which would be a python.exe file and of course everything that goes along with it) then you cannot run a .py file outside of N++, even if that .py file isn’t using anything related to N++ (e.g. <code>editor.</code> and <code>notepad.</code> object function calls).  Conversely, as pointed out above, you <em>can</em> run such a .py file from inside N++.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/39060</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/39060</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 28 Jan 2019 13:26:18 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Mon, 28 Jan 2019 12:32:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/v-s-rawat" aria-label="Profile: V-S-Rawat">@<bdi>V-S-Rawat</bdi></a></p>
<p dir="auto">Yes, this particular script may run outside npp if you have a local<br />
python installation and then by calling <code>python scriptname.py</code></p>
<p dir="auto">Theoretically, you can also uninstall the plugin and remote control<br />
npp and scintilla with the local python installation.<br />
But then you have to program everything yourself<br />
what the pythonscript plugin otherwise provides to you.<br />
The callbacks could be a bigger challenge.</p>
<p dir="auto">A central repo for scripts does not exist, as far as I know,<br />
but a <a href="https://pypi.org/" rel="nofollow ugc">central system for installing modules</a> does.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/39052</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/39052</guid><dc:creator><![CDATA[Eko palypse]]></dc:creator><pubDate>Mon, 28 Jan 2019 12:32:40 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Mon, 28 Jan 2019 12:16:07 GMT]]></title><description><![CDATA[<p dir="auto">That brings another bouncer to me.<br />
<a class="plugin-mentions-user plugin-mentions-a" href="/user/eko-palypse" aria-label="Profile: Eko-palypse">@<bdi>Eko-palypse</bdi></a> said:</p>
<blockquote>
<p dir="auto">Yes, but since it does not use any Notepad ++ objects, it can also be run outside of npp.</p>
</blockquote>
<p dir="auto">You mean same npp pyscript can be run from outside of npp?</p>
<p dir="auto">how? I only have pyscript plugin installed, and it seems it had installed a huge set of files. Are those files sufficient to run npp pyscript from outside npp? How? which exe file to run?</p>
<p dir="auto">or do I have to download python afresh and install that to be able to run python out of npp?</p>
<p dir="auto">And if so, can I think remove pyscript plugin and still be able to run pyscript from within npp?<br />
because that would mean one python installed by pyscript within npp, and another python installed directly in programfiles. Why keep both, there may be version clashes between them.</p>
<blockquote>
<p dir="auto">The ecosystem of Python is really and I mean really huge.<br />
If you are thinking about a problem and how you can solve it, there is most likely already a Python module available that is made for it.</p>
</blockquote>
<p dir="auto">yeah, I was also thinking that across the years that python has been popular and widely used, a huge repository of pyscripts must already have been made. But I find very less repositories very less number of scripts then I thought should have been there. Seems I didn’t not reach major pyscript repositories.</p>
<p dir="auto">Thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/39050</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/39050</guid><dc:creator><![CDATA[V S Rawat]]></dc:creator><pubDate>Mon, 28 Jan 2019 12:16:07 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Mon, 28 Jan 2019 12:02:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/v-s-rawat" aria-label="Profile: V-S-Rawat">@<bdi>V-S-Rawat</bdi></a></p>
<p dir="auto">Yes, but since it does not use any Notepad ++ objects, it can also be run outside of npp.<br />
The ecosystem of Python is really and I mean really huge.<br />
If you are thinking about a problem and how you can solve it, there is most likely already a Python module available that is made for it.<br />
The only little downer is that PythonScript has not implemented pip or it can not be easily implemented (as far as I understand it), which means you have to, if you want to rely on external modules, do some manual work to make it happen within pythonscript plugin.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/39047</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/39047</guid><dc:creator><![CDATA[Eko palypse]]></dc:creator><pubDate>Mon, 28 Jan 2019 12:02:54 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Mon, 28 Jan 2019 11:50:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/eko-palypse" aria-label="Profile: Eko-palypse">@<bdi>Eko-palypse</bdi></a></p>
<p dir="auto">This script will run from within npp and will access net and download all *.py on that page?</p>
<p dir="auto">Quite powerful. I never thought such a thing is even possible.</p>
<p dir="auto">:-)</p>
<p dir="auto">Thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/39046</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/39046</guid><dc:creator><![CDATA[V S Rawat]]></dc:creator><pubDate>Mon, 28 Jan 2019 11:50:25 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Sun, 27 Jan 2019 21:50:29 GMT]]></title><description><![CDATA[<p dir="auto">… or by writing a python script doing it<br />
<a class="plugin-mentions-user plugin-mentions-a" href="/user/v-s-rawat" aria-label="Profile: V-S-Rawat">@<bdi>V-S-Rawat</bdi></a> I leave the implementation of the compressing function to you ;-)</p>
<pre><code>import urllib
import re

sample_url = "https://github.com/bruderstein/PythonScript/tree/master/scripts/Samples"
raw_url = "https://raw.githubusercontent.com/bruderstein/PythonScript/master/scripts/Samples/"
save_dir = r'D:\xyz\{}'

_f = urllib.urlopen(sample_url)
data = _f.read()
links = re.findall('href="(.*?\.py)"', data)
for link in links:
    file = link.rpartition('/')[2]
    urllib.urlretrieve(raw_url + file, save_dir.format(urllib.unquote(file)))
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/39034</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/39034</guid><dc:creator><![CDATA[Eko palypse]]></dc:creator><pubDate>Sun, 27 Jan 2019 21:50:29 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Sun, 27 Jan 2019 21:23:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/v-s-rawat" aria-label="Profile: V-S-Rawat">@<bdi>V-S-Rawat</bdi></a></p>
<blockquote>
<p dir="auto">how can I download all script at bruderstein/PythonScript/scripts/Samples/ as a single zip file?</p>
</blockquote>
<p dir="auto">you can do that by either downloading the whole master repo from <a href="https://github.com/bruderstein/PythonScript/archive/master.zip" rel="nofollow ugc">&gt;&gt;&gt; here &lt;&lt;&lt;</a> and extract PythonScript/scripts/Samples/,</p>
<p dir="auto">… or by downloading them manually one by one, then package them into another zip and commit this zip to david <a class="plugin-mentions-user plugin-mentions-a" href="/user/bruderstein" aria-label="Profile: bruderstein">@<bdi>bruderstein</bdi></a> , with the request for publishing, so that you can re-download it 😉</p>
]]></description><link>https://community.notepad-plus-plus.org/post/39031</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/39031</guid><dc:creator><![CDATA[Meta Chuh]]></dc:creator><pubDate>Sun, 27 Jan 2019 21:23:11 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Sun, 27 Jan 2019 20:40:19 GMT]]></title><description><![CDATA[<p dir="auto">how can I download all script at bruderstein/PythonScript/scripts/Samples/ as a single zip file?</p>
<p dir="auto">Thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/39022</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/39022</guid><dc:creator><![CDATA[V S Rawat]]></dc:creator><pubDate>Sun, 27 Jan 2019 20:40:19 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Fri, 25 Jan 2019 20:28:37 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></p>
<p dir="auto">Since you pointed out that the Pythonscript <code>editor.rereplace()</code> way of working has some distinct advantages (less bugs?) over the Notepad++ interactive Replace dialog, how about a little script for making testing the differences even easier (and less cryptic than typing a one-liner in the PS console):</p>
<pre><code>if editor.getSelectionEmpty():
    p1 = editor.getCurrentPos()
    p2 = editor.getTextLength() - 1
else:
    p1 = editor.getSelectionStart()
    p2 = editor.getSelectionEnd()
s = notepad.prompt('Enter search regex:', '', '')
if s != None and len(s) &gt; 0:
    r = notepad.prompt('Enter replace regex:', '', '')
    if r != None:
        editor.beginUndoAction()
        editor.rereplace(s, r, 0, p1, p2)
        editor.endUndoAction()
</code></pre>
<p dir="auto">If a selection is active when running the script, it acts like N++'s “Replace All…with In Selection ticked”.  Otherwise, it acts like  a normal N++'s “Replace All” acting on text from caret downward to EOF.</p>
<p dir="auto">Not rocket science, but then again neither was the original script way above. :)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38950</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38950</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 25 Jan 2019 20:28:37 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Fri, 25 Jan 2019 19:27:07 GMT]]></title><description><![CDATA[<p dir="auto">Added the script as <a href="https://github.com/bruderstein/PythonScript/blob/master/scripts/Samples/Multiples_SR.py" rel="nofollow ugc">https://github.com/bruderstein/PythonScript/blob/master/scripts/Samples/Multiples_SR.py</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/38927</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38927</guid><dc:creator><![CDATA[chcg]]></dc:creator><pubDate>Fri, 25 Jan 2019 19:27:07 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Fri, 25 Jan 2019 18:52:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a></p>
<p dir="auto">:-) … live is interesting, isn’t it … what is true now might be false in the next minute :-)</p>
<p dir="auto">From modify callback I see that there is a replace but it just ignores the \U</p>
<pre><code>{'code': 2008, 'annotationLinesAdded': 0, 'text': 'this', 'modificationType': 1048576, 'token': 0, 'linesAdded': 0, 'length': 4, 'foldLevelPrev': 0, 'position': 0, 'line': 0, 'foldLevelNow': 0}
{'code': 2008, 'annotationLinesAdded': 0, 'text': 'is', 'modificationType': 1048576, 'token': 0, 'linesAdded': 0, 'length': 2, 'foldLevelPrev': 0, 'position': 5, 'line': 0, 'foldLevelNow': 0}
{'code': 2008, 'annotationLinesAdded': 0, 'text': 'some', 'modificationType': 1048576, 'token': 0, 'linesAdded': 0, 'length': 4, 'foldLevelPrev': 0, 'position': 8, 'line': 0, 'foldLevelNow': 0}
{'code': 2008, 'annotationLinesAdded': 0, 'text': 'text', 'modificationType': 1048576, 'token': 0, 'linesAdded': 0, 'length': 4, 'foldLevelPrev': 0, 'position': 13, 'line': 0, 'foldLevelNow': 0}
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/38924</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38924</guid><dc:creator><![CDATA[Eko palypse]]></dc:creator><pubDate>Fri, 25 Jan 2019 18:52:54 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Fri, 25 Jan 2019 18:37:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/eko-palypse" aria-label="Profile: Eko-palypse">@<bdi>Eko-palypse</bdi></a></p>
<p dir="auto">Wow.  WOW.  I find I cannot reproduce my earlier results.  It seems to be working consistently now (duplicating your results).  I guess I have egg on my face and sorry for the false alarm; unless it takes some sort of special sequence of actions to get into a weird mode!  I did restart N++ an hour ago so I supposed that is a possible occurrence.</p>
<p dir="auto">One thing I am seeing now that the editor.rereplace() is doing “nothing”:</p>
<p dir="auto">I use the LocationNavigate plugin for its ability to specially mark changed lines (wish there was a better/more-current solution to that, btw!).  When I run the scripted replace, although visually no text changes, the plugin does mark every line where <code>\w+</code> matches.  Basically this means all lines besides empty ones got “changed”.  So…not really sure what under-the-hood voodoo magic is happening when using <code>\U</code> (and probably others like it) with a scripted replace, but it sure seems like SOMETHING interesting might be happening. If what is happening is that the \U is being ignored and <code>abc</code> is simply being replaced by <code>abc</code> perhaps that is not all that interesting. :(</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38923</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38923</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 25 Jan 2019 18:37:43 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Fri, 25 Jan 2019 18:12:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a></p>
<p dir="auto">If I understand you correctly, I’m totally lost - my setup must have some kind of builtin wizard as<br />
I do get different result. So just to clarify, having the text <code>this is some text</code> and aiming to get<br />
<code>THIS IS SOME TEXT</code> we would use <code>\w+</code> and replace with <code>\U$0</code> or  <code>(\w+)</code> with <code>\U$1</code> as replacement.<br />
For me, both work the same in the dialog and none work when called like <code>editor.rereplace('\w+','\U$0')</code> from a script.<br />
But you do have a different result?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38922</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38922</guid><dc:creator><![CDATA[Eko palypse]]></dc:creator><pubDate>Fri, 25 Jan 2019 18:12:29 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Fri, 25 Jan 2019 15:11:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said:</p>
<blockquote>
<p dir="auto">why both of these regex replaces only change to uppercase the first letter of every “word” when run with N++ interactive replace (but – and I think act correctly in the script)</p>
</blockquote>
<p dir="auto">Let me correct this:</p>
<ul>
<li>why both of these regex replaces only change to uppercase the first letter of every “word” when run with N++ interactive replace (but the one that involves capturing group #1 and using \1 in the replace part – acts correctly in the script, at least I think it does)</li>
</ul>
<p dir="auto">Hmm, better but maybe still not a great way of expressing it.  :-P</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38912</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38912</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 25 Jan 2019 15:11:04 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Fri, 25 Jan 2019 14:54:19 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> said:</p>
<blockquote>
<p dir="auto">SEARCH \w+</p>
<p dir="auto">REPLACE \u$0</p>
<p dir="auto">AFAIK, they do not modify anything, ( I mean regarding case of characters ! ) when executed from a Python script :-((</p>
</blockquote>
<p dir="auto">Interesting.  I noticed that the following variant on that above WILL work to affect case when using editor.rereplace() in a script:</p>
<p dir="auto">Find: <code>(\w+)</code><br />
Repl: <code>\U\1</code></p>
<p dir="auto">It seems like either variant should capitalize all lowercase letters in a document.  HOWEVER, only the script version does this!  When run interactively with the Replace dialog in Notepad++, these 2 variants only capitalize the first letter of every “word”.</p>
<p dir="auto">Can anyone offer an explanation for:</p>
<ul>
<li>why Guy’s original regex replace does nothing in the script</li>
<li>why both of these regex replaces only change to uppercase the first letter of every “word” when run with N++ interactive replace (but – and I think act correctly in the script)</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/38908</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38908</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 25 Jan 2019 14:54:19 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Sat, 19 Jan 2019 16:07:56 GMT]]></title><description><![CDATA[<p dir="auto">So from what I get is, that there is a difference in the implementation details of boost:regex in npp and pythonscript plugin.<br />
So the best would be if the pythonscript plugin would implement the missing pieces and npp silently <em>steals</em> the code and<br />
adapt it to have it work the same ;-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38700</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38700</guid><dc:creator><![CDATA[Eko palypse]]></dc:creator><pubDate>Sat, 19 Jan 2019 16:07:56 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Sat, 19 Jan 2019 16:05:15 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> said:</p>
<blockquote>
<p dir="auto">When I (say) “With the Python regex engine…”, I’m just saying that I did all the tests with…Alan’s script</p>
</blockquote>
<p dir="auto">“With the Python regex engine” would be my SECOND bullet point above, but that is not what you’re doing unless you’ve changed the <code>editor.rereplace()</code> call in the script to a <code>re.sub()</code> call (and slightly changed the other logic to cope with that change).</p>
<p dir="auto">BTW when you <code>import re</code> (to get access to the re.IGNORECASE aka re.I flag) that is all you are doing–getting access to that, which happens to be shared, for convenience, with the Boost regex engine.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38699</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38699</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 19 Jan 2019 16:05:15 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: any ready pyscript to replace one huge set of regex&#x2F; phrases with others? on Sat, 19 Jan 2019 16:01:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/eko-palypse" aria-label="Profile: Eko-palypse">@<bdi>Eko-palypse</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a></p>
<p dir="auto">So to clarify, when using the Pythonscript plugin, one can do 1 of 2 things:</p>
<ul>
<li>editor.rereplace() which uses the Boost regex that is very similar to, but maybe not exactly the same as the one directly in N++</li>
<li>use re.sub() which uses the Python regex engine (which is its own thing, not Boost, not PCRE, not ANYTHING except Python’s own re module)</li>
</ul>
<p dir="auto">So far I believe everything discussed in this thread is using the FIRST one.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38698</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38698</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 19 Jan 2019 16:01:01 GMT</pubDate></item></channel></rss>