Page 1 of 1

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

PostPosted: Mon Nov 20, 2023 5:21 am
by Jakov
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

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

PostPosted: Mon Nov 20, 2023 8:36 am
by Luuk
With RegEx(1) the "Match" and "Replace" can be like...
^.+- *(.+?) *_.+\((\d+)\)$
\1\2

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

PostPosted: Mon Nov 20, 2023 10:25 am
by Jakov
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

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

PostPosted: Mon Nov 20, 2023 12:18 pm
by Luuk
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

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

PostPosted: Mon Nov 20, 2023 3:37 pm
by Jakov
Thanks so much :)
It works perfectly
You are awesome
Many thanks