Search++ (\W)'(\w) regex replace failure
-
As noted in my post earlier today about an instance of regex replacement failure via Notepad++’s native find/replace functionality, I tried doing the same regex replacement in Search++, but got some bizarre results. As stated in my other post, I was doing this in ANSI text, using FIND WHAT string
(\W)'(\w)and REPLACE WITH string\1’\2. My initial text:this 'Cos I am that this 'Round and 'round thatConsidering your explanation to me in the other thread, I’m assuming my utilization of the same regex via your plugin may have been doomed to failure anyway, but… results after stepping through (one replacement at a time), first attempt:
this ?Cos I am that this -?-ound and-?-ound thatSecond attempt:
this -?-os I am that this ?Round and-?-ound thatAny idea what’s up with that?
-
Considering your explanation to me in the other thread, I’m assuming my utilization of the same regex via your plugin may have been doomed to failure anyway, but… results after stepping through (one replacement at a time), first attempt
Those are strange results, which I can’t reproduce. Your find and replace combination works for all three occurrences on my installation.
Looking at your debug info in the other thread, I see that you have a long list of plugins. I know this is a pain, but would you try:
- Download a fresh, portable copy of Notepad++ (v8.9.7, 32 bit as per your debug info) and unzip that to a folder.
- Download Search++ (v06.3.1, 32 bit), unzip that to a folder and rename the folder
Search++. - Move the
Search++folder into thepluginsfolder within the portable Notepad++ folder. - Double-click
notepad++.exein the portable Notepad++ folder.
and try your test with that copy of Notepad++?
That would at least tell us whether there is something about your system that is different than mine, or something about your plugins or your Notepad++ configuration that is different.
-
I know this is a pain, but would you try:
In the process of attempting to follow your instructions, I suffered a handful of detrimental (though not catastrophic) NPP-related events. Am I supposed to be able to run the portable copy of NPP while the installed copy is also running? When I tried to open the portable, it just brought my installed copy window to the front, and didn’t open anything new. Then I tried closing the installed copy, but immediately got an error dialog. I was hoping to do a screenshot of it but somehow failed to (it may have been something about my session file having been corrupted, as there was no session restoration when I eventually re-opened my installed copy). Rather than hitting OK or whatever option it gave me in the dialog, I tried opening a new installed NPP instance via my AutoHotkey keyboard sequence so I could take some notes that hopefully wouldn’t be affected by whatever problems the first instance was having at that point, but I then immediately got another error dialog, this one specifically for Search++:
A configuration file was found, but it does not contain valid JSON and will be ignored.I hit OK in that one. The new instance opened, and the first error dialog disappeared. I then went ahead and closed the second instance, which resulted in this Search++ dialog:
A configuration file found at startup was ignored because this plugin could not use it. Do you want to save the current configuration settings? (If Yes, the old file will be overwritten.)I hit YES, and then also closed the first instance.
I then finally got the portable copy to open, and tried my regex in it. It all worked.
-
@M-Andre-Z-Eckenrode said:
Am I supposed to be able to run the portable copy of NPP while the installed copy is also running? When I tried to open the portable, it just brought my installed copy window to the front, and didn’t open anything new.The portable version has its own settings stored within the portable folder. By default, Notepad++ runs in single instance mode. I tried it and it appears that when the Notepad++ you are attempting to open is in single instance mode, if any Notepad++ executable is open, it will switch to it instead. If you open the portable alone, with no other Notepad++ running, and change Settings | Preferences… | Multi-Instance & Date to Always in multi-instance mode, then you’ll be able to open the portable when the installed version is already running.
Then I tried closing the installed copy, but immediately got an error dialog. I was hoping to do a screenshot of it but somehow failed to (it may have been something about my session file having been corrupted, as there was no session restoration when I eventually re-opened my installed copy).
I have no guess about that.
Rather than hitting OK or whatever option it gave me in the dialog, I tried opening a new installed NPP instance via my AutoHotkey keyboard sequence so I could take some notes that hopefully wouldn’t be affected by whatever problems the first instance was having at that point, but I then immediately got another error dialog, this one specifically for Search++:
A configuration file was found, but it does not contain valid JSON and will be ignored.Installed copies all share a single set of configuration files (for Notepad++ and plugins). This was probably related to the previous error. A possibility is that, since (if I’m following correctly) the instance with the error was still open, the file might have been present but locked, or incomplete.
Search++ puts up that message when the system says there is a file in the right place with the right name, but when I pass the file name to the JSON parser, it says it doesn’t make sense. I haven’t tested, but I suspect that could happen if the file is inaccessible as well as if it contains invalid JSON.
The next message:
A configuration file found at startup was ignored because this plugin could not use it. Do you want to save the current configuration settings? (If Yes, the old file will be overwritten.)is then expected when you close Notepad++; if there was some reason you didn’t want to lose the current contents of the file (for example, to diagnose how the file came to contain invalid JSON), that would let you preserve them.
I’m sorry that was such a mess. :-(
I then finally got the portable copy to open, and tried my regex in it. It all worked.
Then that means the cause is almost certainly either a plugin or a Notepad++ setting. I don’t know of any Notepad++ settings that would cause what you saw. My guess is that it’s an interaction with one of the plugins.
If you want to try to figure it out, I think the easiest way would be to go to your installed copy of Notepad++ in Windows Explorer, copy the plugins folder, then go to the portable copy, delete the plugins folder, and paste what you copied. Run the portable again and verify that all your plugins are listed. Then see what happens.
If the problem still doesn’t occur in the portable, then there must be a setting that Search++ doesn’t accommodate properly. If the problem does occur in the portable, try removing plugins one by one to see if you can isolate which one makes it go away.
I understand if you don’t want to pursue all this, though. I’ll look at the plugins listed in your debug information and see if I can find any that might cause a conflict.
-
By default, Notepad++ runs in single instance mode. I tried it and it appears that when the Notepad++ you are attempting to open is in single instance mode, if any Notepad++ executable is open, it will switch to it instead. If you open the portable alone, with no other Notepad++ running, and change Settings | Preferences… | Multi-Instance & Date to Always in multi-instance mode, then you’ll be able to open the portable when the installed version is already running.
I think that rather than mucking with the settings that you already have set the way you want in your main N++, to run a portable alongside it is as simple as adding the
-multiInstcommand line parameter to the invocation of the portable. -
By default, Notepad++ runs in single instance mode. I tried it and it appears that when the Notepad++ you are attempting to open is in single instance mode, if any Notepad++ executable is open, it will switch to it instead. If you open the portable alone, with no other Notepad++ running, and change Settings | Preferences… | Multi-Instance & Date to Always in multi-instance mode, then you’ll be able to open the portable when the installed version is already running.
(emphasis added)
I think that rather than mucking with the settings that you already have set the way you want in your main N++, to run a portable alongside it is as simple as adding the
-multiInstcommand line parameter to the invocation of the portable.I didn’t suggest changing the settings of the installed copy, nor would it help if he did. There’s nothing wrong with your method, either, if he’d rather create a shortcut and/or run from the command line.
-
-
I didn’t experiment with adding or subtracting any plugins (other than having already added Search++) in the portable version yet. but I did just open the portable again, this time via command line and
-multiInst, per @Alan-Kilborn’s suggestion (thanks, Alan), while my installed version was already open. I then retried my regex, but this time got anomalous results, such as:this u’dos I am that this ’Round and ’round thatI then undid all replacements, and redid them, with all results correct the second time around.
Quit the portable copy, then reopened it (as
-multiInst) again, then redid the regex, with anomalies:this ’Cos I am that this ’Round and-’-ound thatQuit the portable copy again, then reopened it (as
-multiInst) again, then redid the regex again, with slightly different anomalies:this ’Cos I am that this -’-ound and ’round thatTalk about bizarre. But it seems we can rule out conflicts from the other plugins I use in my installed version, unless there’s some way for them (or something else) to cross-contaminate the process in active memory due to the installed version still being open.
[…shuts down both portable and installed versions; reopens portable version; retries regex…]
Nope. Still had anomalous results:
this ’Cos I am that this -’-ound and ’round thatI’m out of guesses. It’s hit or miss whether or where or how it happens.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login