Help with capitalization case

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Help with capitalization case

Postby nocannothave » Mon Apr 09, 2012 6:20 pm

Because I'm an idiot, I feel the need to rename files where the words a, an, the, and, but, or, nor, for, yet, so, as, at, by, for, in, of, to, and from are currently capitalized and should not be.

I have used Bulk Rename Utility for MANY years, and it almost does the job in this situation. Obviously, I can easily rename to "Title" with exceptions for the above words, but it allows words like 'All or And or Am' to be made lower case. So (I think) it needs to ignore words that don't explicitly match the Excep. list.

Is this possible? Much thanks if you can help!

Examples:

I have Case (4) set to Title, with Excep. field containing: a: an: the: and: but: or: nor: for: yet: so: as: at: by: for: in: of: to: from:

05 - Down In A Hole.mp3 renames to 05 - Down in a Hole.mp3 :D

but

06 - Angry Chair.mp3 renames to 06 - angry Chair.mp3 :cry:
nocannothave
 
Posts: 3
Joined: Thu Jun 02, 2011 3:21 am

Re: Help with capitalization case

Postby nocannothave » Wed Apr 11, 2012 7:17 am

I managed to get my desired results by using MP3Tag and these Actions:

Action type: Replace with regular expression
Field: _TAG
Regular expression: ([-({\[\]}) _",./+&@:;*])(\l)
Replace matches with: $1$upper($2)
[x] case-sensitive comparison

Action type: Format value
Field: _FILENAME
Formatstring: $regexp(%_filename%,'([-({\[\]}) _",./+&@:;*])(\l)',$1\u$2)

Action type: Replace with regular expression
Field: _All
Regular expression: ^(\l)
Replace matches with: $upper($1)
[x] case-sensitive comparison

Followed by...

Action type: Replace with regular expression
Field: _ALL
Regular expression: (?<![/\-:;\(\)\[\]{}])\s(a|an|the|and|but|or|nor|for|yet|so|as|at|by|for|in|of|to|from)(?=\s)(?!\s[\-\(\)\[\]{}])
Replace matches with: $lower($0)
[ ] case-sensitive comparison

Action type: Replace with regular expression
Field: _ALL
Regular expression: (^|\s|\(|\[|/)'(.{1})
Replace matches with: $1'$upper($2)
[ ] case-sensitive comparison
nocannothave
 
Posts: 3
Joined: Thu Jun 02, 2011 3:21 am

Re: Help with capitalization case

Postby gavcol » Sun Apr 28, 2019 3:39 am

nocannothave wrote:Examples:

I have Case (4) set to Title, with Excep. field containing: a: an: the: and: but: or: nor: for: yet: so: as: at: by: for: in: of: to: from:



Wow, 8yr old post !!
Came across this when looking for info of how to use multiple exceptions for Case (4)
I tried all the usual separators ;|, etc but completely forgot about the : colon
Your example above had a space before each word. Removing the space worked for me.
So for your example, it would be the following

Excep. field containing: a:an:the:and:but:or:nor:for:yet:so:as:at:by:for:in:of:to:from:

and for your 06 - Angry Chair.mp3 renames to 06 - angry Chair.mp3, you would need to put a space after the word/letter and before the colon

Excep. field containing: a :an :the :and:but :or :nor :for :yet :so :as :at :by :for :in :of :to :from:

That would then ensure words like Angry, Theatre, Butterfly, Orange etc Sorry, Bypass etc etc would be left alone. Although you'd still have to play around with the placement of the spaces depending on the scenario and your requirements.

Cheers
Gav
gavcol
 
Posts: 7
Joined: Thu Sep 20, 2018 2:43 pm


Return to BRU Support