010 - Aaaaa

A swapping-ground for Regular Expression syntax

010 - Aaaaa

Postby Jack2 » Wed Jan 05, 2022 10:49 pm

Hi

I'm loving the new 'Title Enhanced' Case mode.

I want to rename a bunch of music files using it.

They are in the format

nn - Songnamewordone Songnamewordtwo
nnn - Songnamewordone Songnamewordtwo
nnnn - Songnamewordone Songnamewordtwo

(where 'n' is a numeric (Tracknumber))

Also, sometimes in the format:

nn - Artistnamewordone Artistnamewordtwo - Songnamewordone Songnamewordtwo

As expected, where Songnamewordone (or Artistnamewordone) starts with one of the New York Times 'small' words, the 'Title Enhanced' mode puts it into lower case. What I need is a Regex expression to then recapitalise it.

i.e. I want to turn:

01 - the Importance of Being Idle.mp3
105 - an Englishman in New York.mp3
06 - the Joe Dolce Music Theatre - Shaddap You Face.mp3
0107 - a Certain Ratio - a Frenchman in New York.mp3

into

01 - The Importance of Being Idle.mp3
105 - An Englishman in New York.mp3
06 - The Joe Dolce Music Theatre - Shaddap You Face.mp3
0107 - A Certain Ratio - A Frenchman in New York.mp3

The delineators are SPACEHYPHENSPACE. Generally, there aren't any other hyphens in the filenames.

I'm not good with Regex, (I can't even get the 'Hello World' /U examples from the operations manual to work!)

thanks a lot
Jack2
 
Posts: 20
Joined: Wed Nov 14, 2018 4:32 pm

Make exceptions for Title Enhanced

Postby Luuk » Thu Jan 06, 2022 3:03 am

First inside of Filters(12) to put a 'Mask' like ^\d{2,4} - .+ with a checkmark inside of 'RegEx'.
Then there can be 2 different ways to capitalise every 1st-character that does come after each " - "...

Method-1: If you did already finish renaming with Title-Enhanced??
RegEx(1) just needs a checkmark in 'v2' with a 'Match' and 'Replace' like...
( - .)/g
\U$1

Method-2: If wanting to make exceptions for Title-Enhanced??
RegEx(1) needs a checkmark in 'v2' with a 'Match' and 'Replace' like...
(?<= - )(.)/g
|\U$1

After each ' - ' RegEx(1) converts words like... 'the' or 'a' ==> |The or |A to smuggle them past Case(4), so he wont change them.
So after they get smuggled past Case(4) Title-Enhanced, then Remove(5) just uses "|" inside for the 'Chars'.
Luuk
 
Posts: 380
Joined: Fri Feb 21, 2020 10:58 pm

Re: 010 - Aaaaa

Postby Jack2 » Thu Jan 06, 2022 3:08 pm

That's awesome - thanks a ton. :D
Jack2
 
Posts: 20
Joined: Wed Nov 14, 2018 4:32 pm


Return to Regular Expressions