Remove all alphabetical charachters after the first symbol (

Bulk Rename Utility How-To's

Remove all alphabetical charachters after the first symbol (

Postby Lincoln Hawk » Mon Aug 21, 2023 3:33 pm

Hello,

I really do apologize to ask for your help, I have been trying to read older threads for hours but I cannot find anything working for my needs.

I have a lot of files that follow this structure:

I Am A Noob (Myself, 2023) - B Jovi, A Einstein, M Jordan.mkv

I need to bulk rename all of them by keeping ONLY numbers and ) after the first (

in details the example above has to be renamed into

I Am A Noob (2023).mkv

Can someone help me please^

P.S. I treid a lot of the suggested scripts for RegEx(1) that I found in other threads but it seems not to work. The closest I got is to use the Remove (5) section and tell the tool to remove everything after ), but it is just one part of the problem. Ideally it would be enough if I could find a way to used the rules included in Remove (5) but telling the tool to start applying then only after the first (

Thanks a lot in advance
A noob waiting to someone to save his life :)
Lincoln Hawk
 
Posts: 4
Joined: Mon Aug 21, 2023 3:24 pm

Re: Remove all alphabetical charachters after the first symbol (

Postby Lincoln Hawk » Mon Aug 21, 2023 4:06 pm

Edit...

I have reached the following intermediate step in RegEx (really satisfying)...

I Am A Noob (Myself, 2023) - B Jovi, A Einstein, M Jordan.mkv

Match
(.*)(\(.*\))(.*)

Replace
\1\2

In this way I can easily exclude what's after the closing parenthesis, but I would need a command that will include for \2 numbers and symbols only, excluding any english charachter... I should put some rules within the second part of the match expression higlighted in red, shouldn't I?

(.*)(\(.*\))(.*)
Lincoln Hawk
 
Posts: 4
Joined: Mon Aug 21, 2023 3:24 pm

Re: Remove all alphabetical charachters after the first symbol (

Postby Lincoln Hawk » Mon Aug 21, 2023 4:34 pm

Edit 2

With the following formula

Match
(.*)(\(.*?(\d\d\d\d\d?).*\))(.*)

Replace
\1\3

I have been able to reach this result, from:

I Am A Noob (Myself, 2023) - B Jovi, A Einstein, M Jordan.mkv

To

I Am A Noob 2023.mkv

Now it is just a matter to preserve the parenthesis....
Lincoln Hawk
 
Posts: 4
Joined: Mon Aug 21, 2023 3:24 pm

Re: Remove all alphabetical charachters after the first symbol (

Postby Lincoln Hawk » Mon Aug 21, 2023 4:36 pm

I am done!!!

Final formula is

Match

(.*)(\(.*?(\d\d\d\d\d?).*\))(.*)

Replace
\1(\3)

I am super excited I have been able to figure out by myself. Thanks a lot anyway for your effort in all the previous discussions, it has been fundamental for me!!

Hope it helps some other noob in the future
Lincoln Hawk
 
Posts: 4
Joined: Mon Aug 21, 2023 3:24 pm

Re: Remove all alphabetical charachters after the first symbol (

Postby Admin » Tue Aug 22, 2023 9:25 am

Great effort with RegEx ! 8) Glad that you could make it work
Admin
Site Admin
 
Posts: 2354
Joined: Tue Mar 08, 2005 8:39 pm


Return to How-To


cron