Delete a variable text string in File Name

Bulk Rename Utility How-To's

Re: Delete a variable text string in File Name

Postby dec » Fri Sep 08, 2023 9:19 am

dec wrote:
dec wrote:ok.

so what is Regex if we want to locate a unique text string, and then delete n no of characters after it?

this is basically because of a 'bug' in BRU where the Add module can take a NEGATIVE value (much to my surprise) - and therefore works from the end which is very very useful/essential; BUT the Remove module DOES NOT HAVE THE SAME FUNCTIONALITY

so my idea is that i will use the Add function using the negative value from the end of name to add a unique string eg 'xxx' at the start of the string to remove, and then use Regex to find that unique string, and remove n characters after it (something like [norm91] [192kbits 48mHz] which are old redundant values)


oh. here is a CORRECT name
Van Morrison - Sweet Thing [2010] [conv-192] [norm-aimp-0db] [256 kbps 48 kHz] [04_26min]

and here is one to fix ...
Alma Cogan - Twenty Tiny Fingers [norm91] [192 kbps 44 kHz] [conv-192-48kHz] [norm-aimp-0db] [239 min]

that is not an exact example but you get the idea


BB King - Rock Me Baby [How Blue Can You Get - Track 13] [1411kbits 44kHz] [conv-96khz] [0433min] [864kbits 96kHz] [conv-192] [norm-aimp-0db] [04_33min]

BB King - Rock Me Baby [How Blue Can You Get - Track 13] [1411kbits 44kHz] [conv-96khz] [0433min] [864kbits 96kHz] [conv-192] [norm-aimp-0db] [04_33min]
dec
 
Posts: 67
Joined: Thu Oct 14, 2021 6:31 am

Re: Delete a variable text string in File Name

Postby therube » Mon Sep 11, 2023 5:48 pm

but your example had it seems... \s\space[norm)

No.
It appears that way - on the board.

Code: Select all
Match:  (.*)(\s\[norm)

vs
Code: Select all
Match:  (.*) (\s\[norm)
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm

Re: Delete a variable text string in File Name

Postby therube » Mon Sep 11, 2023 6:01 pm

1:RegEx
Code: Select all
Match:  (.*)(\s\[norm.*?])(\s\[.*?])(.*)
Replace:  \1\4

match anything
up to [norm.*] (non-greedy)
match then next [.*] (non-greedy)
match all else

Replace: says to only include 'match anything' & 'match all else' (ignoring [norm.*] & the following [.*]

Code: Select all
Anneke Van Giersbergen - Time After Time [La Scene Bastille] [2012] [136kbits 48kHz] [conv-96kHz] [619 min] [868 kbps 96 kHz] [conv-192] [norm-aimp-0db] [619 min] - Copy.flac
->   Anneke Van Giersbergen - Time After Time [La Scene Bastille] [2012] [136kbits 48kHz] [conv-96kHz] [619 min] [868 kbps 96 kHz] [conv-192] - Copy.flac


Code: Select all
BB King - Rock Me Baby [How Blue Can You Get - Track 13] [1411kbits 44kHz] [conv-96khz] [0433min] [864kbits 96kHz] [conv-192] [norm-aimp-0db] [04_33min]
->   BB King - Rock Me Baby [How Blue Can You Get - Track 13] [1411kbits 44kHz] [conv-96khz] [0433min] [864kbits 96kHz] [conv-192]



Note my earlier method simply removed anything that followed '[norm'.
This latter method removes '[norm.*] & the following [.*], while retaining anything that may follow.
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm

Previous

Return to How-To


cron