daddel80 / notepadpp-multireplace

MultiReplace is a plugin for Notepad++ enabling multi-string replacement, allowing list saving and loading. It provides CSV syntax highlighting and enabling precise column targeting. Additionally, it introduces conditional and computational operations within the replacement string.
GNU General Public License v2.0
20 stars 7 forks source link

Issues when text has special character like colon : #51

Closed nassan-github closed 2 months ago

nassan-github commented 2 months ago

Hello, Trying to replace a set of strings into a file but it fails when the character : is in the find text. It is not being replaced.

Example below:

1,Other Options,Other Options [NE],1,1,0,0,0 1,Please choose one:,Please choose one: [NE],1,1,0,0,0 1,Deduct From,Deduct From [NE],1,1,0,0,0 1,Deducted From:,Deducted From: [NE],1,1,0,0,0

rows 1 and 3 are OK rows 2 and 3 are not being replaced in the file because of the colon at the end.

thank you in advance!

daddel80 commented 2 months ago

Hi nassan-github,

Thanks for reporting the issue. I tried replacing the following text using the replacement list you provided. For me, both Replace All and Replace are working:

Other Options
Please choose one:
Deduct From
Deducted From:

Maybe you can provide more details on what I might have missed. What is your Scope setting? Here's what I tried:

Replace_with_Colon

nassan-github commented 2 months ago

Thank you for getting back.

Can you please try it on this file? en_us.json

daddel80 commented 2 months ago

Hi nassan-github,

The issue is because "Match whole word only" is enabled for those two lines. The colon : in the JSON file is directly followed by a quote, which is considered part of the word in this context. To make the replacement work, you'll need to disable "Match whole word only" for the strings with colons since there's no space after the colon. Your list should look like this:

1,"Other Options","Other Options [NE]",1,1,0,0,0
1,"Please choose one:","Please choose one: [NE]",0,1,0,0,0
1,"Deduct From","Deduct From [NE]",1,1,0,0,0
1,"Deducted From:","Deducted From: [NE]",0,1,0,0,0

Give it a try. I hope this resolves your problem. If you need further help, feel free to ask.

nassan-github commented 2 months ago

This has indeed solved the issue, thank you very much!