Multi Rename Tool: multiple replacements at once
Moderators: white, Hacker, petermad, Stefan2
Multi Rename Tool: multiple replacements at once
Hello!
I would like to be able to make multiple replacements at once.
Either by RegEx string or by TC GUI (dialog box).
The RegEx version could work like in Notepad++ S&R.
Notepad++ uses following syntax to make multiple replacements:
(String)|(String)|(String)
(?1ReplaceString)(?2ReplaceString)(?3ReplaceString)
For example:
(cat)|(dog)|(bird)
(?1Garfield)(?2Rantanplan)(?3Tweety)
will replace "cat" with "Garfield", "dog" with "Rantanplan" and "bird" with "Tweety"
The TC GUI version could work like the Plugins Search dialog (more rules or less rules)
By now there are some workarounds, but I'd rather like to have this functionality as described above.
Could you please add this feature?
I would highly appreciate it.
I would like to be able to make multiple replacements at once.
Either by RegEx string or by TC GUI (dialog box).
The RegEx version could work like in Notepad++ S&R.
Notepad++ uses following syntax to make multiple replacements:
(String)|(String)|(String)
(?1ReplaceString)(?2ReplaceString)(?3ReplaceString)
For example:
(cat)|(dog)|(bird)
(?1Garfield)(?2Rantanplan)(?3Tweety)
will replace "cat" with "Garfield", "dog" with "Rantanplan" and "bird" with "Tweety"
The TC GUI version could work like the Plugins Search dialog (more rules or less rules)
By now there are some workarounds, but I'd rather like to have this functionality as described above.
Could you please add this feature?
I would highly appreciate it.
Asus Maximus VIII Hero · Win10 Pro x64
Crucial MX500 1TB SSD · 64GB Corsair Vengeance LPX · nVidia GeForce RTX 3060 · Intel i7 7700K
Lenovo ThinkPad X1 Yoga 2.Gen · Win10 Pro x64
512GB SSD · 16GB RAM · intel HD620 · i7-7600U
TC 11.02 32-bit #347308
Crucial MX500 1TB SSD · 64GB Corsair Vengeance LPX · nVidia GeForce RTX 3060 · Intel i7 7700K
Lenovo ThinkPad X1 Yoga 2.Gen · Win10 Pro x64
512GB SSD · 16GB RAM · intel HD620 · i7-7600U
TC 11.02 32-bit #347308
- ghisler(Author)
- Site Admin
- Posts: 48028
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Multi Rename Tool: multiple replacements at once
How does Notepad++ resolve the problem that | is also allowed inside a single regular expression?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: Multi Rename Tool: multiple replacements at once
2ghisler
Notepad++ uses boost regular expression engine and syntax built on top of PCRE. (it could be a bit over-complicated as it is not not yet a wildly used standard.)
In replace mode you have special syntax for conditional group replacemcent see documentation. You also have a lot of feature like backtracking, named group.... wich need a lot of practice to be well used...
Notepad++ uses boost regular expression engine and syntax built on top of PCRE. (it could be a bit over-complicated as it is not not yet a wildly used standard.)
In replace mode you have special syntax for conditional group replacemcent see documentation. You also have a lot of feature like backtracking, named group.... wich need a lot of practice to be well used...
- ghisler(Author)
- Site Admin
- Posts: 48028
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Multi Rename Tool: multiple replacements at once
I see, so you need to put each regular expression in braces ( ).
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: Multi Rename Tool: multiple replacements at once
Christianso you need to put each regular expression in braces ( )
I am also interested by that feature.
But, instead of coding at once complicated rules, you could, in first time, rather, limit expressions between braces to not regexp, just simple text. And separate each argument just by |.
And so, braces become unuseful. Only separator would be |, in search and in replace fields.
Re: Multi Rename Tool: multiple replacements at once
Christian
I am also interested by that feature.
But, instead of coding at once complicated rules, you could, in first time, rather, limit expressions between braces to not regexp, just simple text. And separate each argument just by |.
And so, braces become unuseful. Only separator would be |, in search and in replace fields.
[/quote]Today,
This work like this out of the box ! replace one by -1-, two by -2-, three by -3-.
I am also interested by that feature.
But, instead of coding at once complicated rules, you could, in first time, rather, limit expressions between braces to not regexp, just simple text. And separate each argument just by |.
And so, braces become unuseful. Only separator would be |, in search and in replace fields.
[/quote]Today,
This work like this out of the box !
Code: Select all
Search For: One|Two|Three
Replace with: -1-|-2-|-3-
Re: Multi Rename Tool: multiple replacements at once
I agree - I use the multi rename tool for cleaning characters from downloaded mp3 filenames that cause errors in the SanDisk clip sport mp3 player. One by one I am searching for * $ & ( ) ñ ™ etc... and replacing with a blank space. I'd love to be able to do that all in one action.
-
- Power Member
- Posts: 872
- Joined: 2013-09-04, 14:07 UTC
Re: Multi Rename Tool: multiple replacements at once
No need to do this laboriously one character by one character. This can be handled by a rather simple single regular expression. Just put all the characters you want to replace with a blank into a character class (plus a repetion quantifier if you want to avoid two or more spaces following each other); for example like:Jaredcat wrote: ↑2020-05-22, 10:48 UTC I agree - I use the multi rename tool for cleaning characters from downloaded mp3 filenames that cause errors in the SanDisk clip sport mp3 player. One by one I am searching for * $ & ( ) ñ ™ etc... and replacing with a blank space. I'd love to be able to do that all in one action.
Code: Select all
[$&()ñ™]+
(When perusing the interwebs, be aware that different flavors/variants of regular expression exist in the world, which can differ -- sometimes just subtly -- in syntax, features and behavior. TC uses a regular expressions implementation called TRegExpr; see here for more details: https://regex.sorokin.engineer/en/latest/regular_expressions.html)