Page 1 of 1

Removing words between [ ] from file names

PostPosted: Sun Jun 27, 2021 5:55 pm
by subongo
Hi
How do I go from a title that looks like this:- How To Hold Your Drumsticks Correctly - Drum Lesson [EePm3QsqnOM]
to this:- How To Hold Your Drumsticks Correctly - Drum Lesson

I am simply trying to remove any thing between the square brackets in multiple files.

Re: Removing meaningless words from file names

PostPosted: Mon Jun 28, 2021 4:52 am
by Luuk
For the example, you can use RegEx(1) with a checkmark in "Simple", and a Match and Replace like...
%1 [%2]
%1

Re: Removing words between [ ] from file names

PostPosted: Mon Jun 28, 2021 10:37 pm
by subongo
:D Many thanks Luuk. I do not understand the logic of how it works but it works and has saved me tons of time :D

Re: Removing words between [ ] from file names

PostPosted: Tue Jun 29, 2021 2:51 am
by Luuk
It removes the first-occurence of " [word]" and everything after, so be careful with it! For your example its no trouble, but names like...
aaa [bb] ccc ddd.txt ===> aaa.txt
111 [22] 33 [44].txt ===> 111.txt

If only wanting to remove [word] at the very end, remove the checkmark from 'Simple' using a Match and Replace like...
(.+[^ ]) +\[[^]]*\]$
\1

Or if wanting to remove all " [words]" and keep everything else, you can put a checkmark in "v2" using only a Match like...
\ \[[^]]*\]/g