Remove from start to , Remove from last to, Remove ()

Bulk Rename Utility How-To's

Remove from start to , Remove from last to, Remove ()

Postby Jakov » Mon Nov 20, 2023 5:21 am

Hi,
I have a list of file names according to this pattern
BRU - Name _BRU.com(N)
N = certain number
Firstly, I want to remove from the start to -
Secondly, Remove from the last to _
Lastly, Remove parenthesis without its content, just ()

Thanks
Jakov
 
Posts: 54
Joined: Sat May 23, 2020 1:29 am

Text1 - Text2 _Text3(#) ----> Text2#

Postby Luuk » Mon Nov 20, 2023 8:36 am

With RegEx(1) the "Match" and "Replace" can be like...
^.+- *(.+?) *_.+\((\d+)\)$
\1\2
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm

Re: Remove from start to , Remove from last to, Remove ()

Postby Jakov » Mon Nov 20, 2023 10:25 am

Thanks for reply
Dear Luuk :)
Excuse me I forgot to mention that (N) is not always exist at the end of the file name
So when I applied this code, it worked perfectly only for file names that end with (N)
So, please can you modify this code to remove (N) when it is present? keep in mind to remove () without its content.
Thanks
Jakov
 
Posts: 54
Joined: Sat May 23, 2020 1:29 am

Re: Remove from start to , Remove from last to, Remove ()

Postby Luuk » Mon Nov 20, 2023 12:18 pm

This needs a checkmark inside for "v2", and renames anything with "-" and "_" inside of the filenames.
^.+ *- *(.+?) *_.+?($|\((\d+)\)$)
$1$3

BRU - Name _BRU.com ------> Name
BRU - Name _BRU.com(7) ---> Name7
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm

Re: Remove from start to , Remove from last to, Remove ()

Postby Jakov » Mon Nov 20, 2023 3:37 pm

Thanks so much :)
It works perfectly
You are awesome
Many thanks
Jakov
 
Posts: 54
Joined: Sat May 23, 2020 1:29 am


Return to How-To