Page 1 of 1

Removing a year between parenthesis but not characters

PostPosted: Wed Aug 25, 2021 2:57 pm
by zahrex
I just downloaded BRU and am a bit overwhelmed with all the features but I don't see scanning through posts how to do this:

I have files and folders that have the year in the filename between parenthesis.

Ex #1. Document XYZ (2021) Final Report.doc

There are however ones that have the year and/or characters between parenthesis.

Ex #2. Document ABC (2020) Initial Report (HOLD).doc
or
Ex #3. Document QRS Initial Report (DALE).doc



I'm looking to replace the year with parenthesis with "-" but not do anything with the rest of the name.

Output ( I want):

Ex. #1 Document XYZ - Final Report.doc
Ex. #2 Document ABC - Initial Report (HOLD).doc
Ex #3. Document QRS Initial Report (DALE).doc

Replace last ' (year) ' ===> ' - '

PostPosted: Wed Aug 25, 2021 10:14 pm
by Luuk
To replace only the last ' (year) ' ===> ' - ', can use the RegEx(1) with a 'Match' and 'Replace' like...
(.+ )\((19|20)\d\d\)( .+)
\1-\3

Re: Removing a year between parenthesis but not characters

PostPosted: Wed Aug 25, 2021 11:28 pm
by zahrex
I tried this on my examples and it worked fine!

Thanks for helping me and for replying so quickly too! :)