Remove a character with multiple exceptions

Advanced Renamer forum
#1 : 14/01-25 03:15
Tavo
Posts: 8
Hello and happy new year everyone!


I have a help request about how to remove a certain repetitive character from a list of files, but the removal is only desirable on some of the files not matching certain criteria...

In short: Remove the Plus Sign present in all the filenames and leave a blank space between words and/or numbers but with some filename exceptions, let's illustrate:

Remove on files like:

fitness+coach+premium+35.22+534543
calculator+plus+1.3+install

To be like:

fitness coach premium 35.22 Build 534543
calculator plus 1.3 install

BUT not on some of the filenames on the same list like this where the plus sign is desirable:

memory checker v12.1 (android 13+)
bluetooth codec+ v5.0

Which method to implement and how to add the expections please!
#2 : 14/01-25 05:21
Delta Foxtrot
Posts: 401
Reply to #1:

Hi Tavo, welcome back, and happy new year!

Here's something that will work in the examples you gave:

REPLACE method:

Replace: \+([^\) ])
With: $1 [1 space before $1, none after]
Use regular expressions: checked
Apply to: Name

This just says replace any plus signs unless they are followed by a ")" or a space. I'm not sure it will work in all your filenames, but you might be able to add more exceptions in the "([^\) ]) capturing group.

Let us know how this works for you.

Best,
DF
#3 : 14/01-25 06:03
Styb
Posts: 142
Reply to #1:
Hi Tavo, I wasted some time trying to write in understandable English, and then I saw that Mr. DF proposed a much more elegant solution than mine, which I will however publish since it is now ready :D

To get the desired result, you need to find a common pattern in the names of the files that must not be changed, and in the examples you have published, the common pattern that I found is space-somecharacters-plus.
So choose the "replace" method:
Text to replace: "+" (without quotes)
Replace with: (space)
Apply to: Name

and set a condition by clicking {If}:
Field: Name and regular expression
Pattern: " (.)+" (without quotes, with a space at the beginning and no space at the end)
Enable the "Not matching" option.
Now you can run the batch.

See the image below:
https://i.postimg.cc/fyG9d6nB/Img70.png

Regards from Italy :)

edited: 14/01-25 06:05
#4 : 14/01-25 06:29
Tavo
Posts: 8
DF & Styb TY for your solutions! Both strategies work flawlessly to remove the plus sign from ALL the filenames in the same list;

... however... as I mentioned before, there are some filenames where I want to conserve the plus sign (about 6 or 7 files btw), how can I make (lets say) an exception for every one of these files?
#5 : 14/01-25 07:08
Styb
Posts: 142
Reply to #4:
Hi Tavo,
In both of the suggested solutions, you have the option of not removing the + sign from the names of the files you gave as an example, namely "bluetooth codec+ v5.0" and "memory checker v12.1 (android 13+)", so I don't understand why you replied that the + sign is removed from ALL files.
As explained, you need to look for the exceptions to add in the DF solution, or find a common pattern as in my solution.
If you have difficulty, try posting other examples of filenames that should not be changed.
#6 : 14/01-25 09:19
Tavo
Posts: 8
Reply to #5:

Sorry Styb, my bad! You're right, didn't get it the first time I rode it, but finding the common pattern to add the exception worked great for either solutions

As always DF and Styb thank you very much for your valuable assistance!

Best,
Tavo