PERL Regular Expressions to search and replace all characters between brackets


Here is a regular expression you can use, if you need to perform a search and replace operation in file names. This example works in editors like the Bulk Rename Utility, that will let you form PERL regular expressions, in order to remove a part of several file names included between brackets, a part that is not exactly the same in all those names.

Let’s say you have several files like this one: 08 [Barb Jungr – I Love Paris] Barb Jungr – I Love Paris.wav, and you need to clean the names by removing whatever is included between brackets, in order to get names like this: 08 Barb Jungr – I Love Paris.wav

In the “Match” box of the RegEx section in Bulk Rename Utility paste this expression:

(.+) \[.+\] (.+)

and in the next, the “Replace”, box paste this expression:

\1 \2

This way you will be able to keep the parts of your file names that precede and follow any characters (words, numbers, special characters) included in brackets.

    Comments are closed, but you can send email