# Capitalisation Action

**URL:** https://community.mp3tag.de/t/capitalisation-action/42131
**Category:** Support
**Created:** [June 30, 2018, 8:13am UTC](https://community.mp3tag.de/t/capitalisation-action/42131 "2018-06-30T08:13:15Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)
#### Post date: [June 30, 2018, 8:13am UTC](https://community.mp3tag.de/t/capitalisation-action/42131/1 "2018-06-30T08:13:15Z")

</div>

Came across this action and wondered if there a way to make this also change the file names in the same way as well as part of the same action?

```
[#0]
T=1
F=_TAG
1=1
2=

[#1]
T=4
F=_TAG
1=\\\\b(A|An|The|And|But|Or|So|After|Before|Out|When|While|Since|Until|Although|Even If|Because|About|Above|Across|Against|Along|Alongside|As|At|Below|By|During|For|From|In|Into|Of|Off|On|Onto|Over|Than|Through|Till|To|Under|Up|With|Within|Without)\\\\b
2=$lower($1)
3=0

[#2]
T=4
F=_TAG
1=^\\\\s*(\\\\w+)
2=$caps($1)
3=0

[#3]
T=4
F=_TAG
1=(\\\\w+)\\\\s*$
2=$caps($1)
3=0

```

Does this work correctly on tracks featuring time like AM or PM or ft (featuring)? I want to make sure AM & PM are always upper case and ft or feat are lower case. Same goes for the letters in 1st, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th, 9th, 10th and so on staying lower case.

Also, how do I stop it replacing normal brackets with square brackets and stop it changing the case from upper to lower for the first letter after an open bracket?

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [June 30, 2018, 9:23am UTC](https://community.mp3tag.de/t/capitalisation-action/42131/2 "2018-06-30T09:23:43Z")

</div>

> [@sheepdisease](#):
>
> I want to make sure AM & PM are always upper case and ft or feat are lower case.

It is nearly impossible to achieve that.  
No computer can see a difference for AM between  
a) I AM the best  
b) I see you at 9 AM

If the two letters `ft` or 4 letters `feat` are always surrounded by a space, then you can use an action to write them lower case (and avoid wrong lower case at the beginning of the title or as part of another word like `left` or `feather`)

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [June 30, 2018, 9:39am UTC](https://community.mp3tag.de/t/capitalisation-action/42131/3 "2018-06-30T09:39:31Z")

</div>

see here on changing the case of filenames:

> [@\[X\] File Name Case Conversion](https://community.mp3tag.de/t/x-file-name-case-conversion/40953):
>
> I have noticed that lately, the command I created to change the filename to all Uppercase text and Lowercase extension is not working for all the files. It used to work perfectly a couple updates back (not sure what update number). Has anyone else encountered this issue?

and here on how to sedt special characters as word boundary:

> [@A couple of suggestions](https://community.mp3tag.de/t/a-couple-of-suggestions/14494):
>
> I have been using MP3Tag for a couple of years and I find it to be one of the most useful programs on my PC, so kudos to the dev team. Thank you for a great program. That said, I have found a couple of things missing. when using the Action-\>Capitalize Each Word, MP3Tag does not capitalize the word behind a parenthesis, such as (dance Mix), it would be nice to have it capitalize it like (Dance Mix). It would be nice to have an action that converted brackets [] to parenthesis () and the other w…

---

<div class="post-metadata">

### Author: ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)
#### Post date: [June 30, 2018, 4:33pm UTC](https://community.mp3tag.de/t/capitalisation-action/42131/4 "2018-06-30T16:33:48Z")

</div>

Thank you for your reply. Does it make a difference that AM or PM would always come after a number?

Also, not sure how to implement what you have described in your second paragraph as part of the existing script detailed above.

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [June 30, 2018, 7:01pm UTC](https://community.mp3tag.de/t/capitalisation-action/42131/5 "2018-06-30T19:01:42Z")

</div>

> [@sheepdisease](#):
>
> Does it make a difference that AM or PM would always come after a number?

Would be just a litte bit better, because there are still cases like  
c) Meeting at nine AM  
But - of course - you can try to get solved 80% of your cases automatically and fix the other 20% manually.

> [@sheepdisease](#):
>
> Also, not sure how to implement what you have described in your second paragraph as part of the existing script detailed above.

I'm not sure where you got the above script. Maybe an export of several actions?  
You can try to find an existing "regular expression" or "replace action" similar to this examples:

> [@Renaming/Replacing all Feat. feat. Ft. etc.. to (feat. XYX)](https://community.mp3tag.de/t/renaming-replacing-all-feat-feat-ft-etc-to-feat-xyx/16913):
>
> Hi, I am very new to this, so apologies if I come across a little naive [:rolleyes:] I have already searched this forum and tried my best to do what I need, but I've hit a brick wall and was hoping one of you kind people can help? Ok, what I am hoping to achieve...? To rename/replace all the following text within all of the fields Featuring. Featuring featuring. featuring Feat. Feat feat. feat Ft. Ft (Featuring. XYZ) (Featuring XYZ) (Feat. XYZ) (Feat XYZ) (feat XYZ) (Ft. XYZ…

or

> [@Please help! Changing all instances of Feat. Ft. to ft](https://community.mp3tag.de/t/please-help-changing-all-instances-of-feat-ft-to-ft/8999):
>
> Hi I have planned out the steps I need in order to rename my music but in order to get the ball rolling I need to know how to change all instances of Feat., Ft., Featuring to ft (lower case, no dot) Example: David Guetta - Love Takes Over Ft. Kelly Rowland becomes... David Guetta - Love Takes Over ft Kelly Rowland Please help! Thank you to anyone who can help me!

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [July 1, 2018, 2:23pm UTC](https://community.mp3tag.de/t/capitalisation-action/42131/6 "2018-07-01T14:23:58Z")

</div>

> [@LyricsLover](#):
>
> No computer can see a difference for AM between

Nice point.  
I found this article on A.M. and P.M. by the Washington University.  
So it may be worth a try to get the correct spelling first (with dots inbetween) and then it should be easy to get the right case.  
[https://brians.wsu.edu/2016/05/16/am-pm/](https://brians.wsu.edu/2016/05/16/am-pm/)

---

<div class="post-metadata">

### Author: ![djrip](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@djrip](https://community.mp3tag.de/u/djrip)
#### Post date: [May 15, 2024, 3:54pm UTC](https://community.mp3tag.de/t/capitalisation-action/42131/7 "2024-05-15T15:54:53Z")

</div>

Probably a moot point now, but using a combination of string functions, we can test if there's a number preceding the AM. Also, assume A.M | A.M. (upper or lower case) are times and should be changed to AM if that's your naming convention)

These should help  
$ifgreater(a,b,x,y), [nested]  
$isdigit(x),  
$strstr(x,y),  
$mid(x,i,n),  
$sub(x,y)

I'll write it in pseudo code and if anyone wants it, we can do regular MP3TAG code.

Test: Is there AM in the string  
NO = EXIT  
YES=  
...Get position of AM - $strstr(TITLE,AM)  
...IF position is MORE than 2 (\>2) characters from left, THEN  
......Come back 2 positions and test if that (trimmed) is a number.  
......If NUMBER, Capitalise, ELSE  
......IF position IS 2 characters from left, THEN  
.........Come back 1 positions and test if that is a number.  
............If NUMBER, Capitalise, ELSE  
END

The reason you test if the position of AM is greater than 1 is the string may start with AM. I'm sure there's more simple regex code to do this but I'm still learning regex.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [May 15, 2024, 6:16pm UTC](https://community.mp3tag.de/t/capitalisation-action/42131/8 "2024-05-15T18:16:17Z")

</div>

I would not do it automatically at all but filter for files that might contain AM or PM preceeded with a number  
Flter: `%title% MATCHES "\d+ AM"  
and then replace all "am"s with AM.

---

<div class="post-metadata">

### Author: ![djrip](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@djrip](https://community.mp3tag.de/u/djrip)
#### Post date: [May 17, 2024, 11:21am UTC](https://community.mp3tag.de/t/capitalisation-action/42131/9 "2024-05-17T11:21:24Z")

</div>

Seems easier. I guess I just want to be able to automate as much as possible seeing as I literally have 100s of thousands of songs.  
Thanks

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [May 17, 2024, 12:13pm UTC](https://community.mp3tag.de/t/capitalisation-action/42131/10 "2024-05-17T12:13:56Z")

</div>

Even if you check for the digit in front ...  
Paul Hardcastle has a track called "A.M." - no digit but capitals  
The Gorillaz have a track "Andromeda" with D.R.A.M - no digit but capitals

With digits I found "2 Ameisen und ein Elefant"  
and by U2 "One [Apollo 440 Ambient Mix]"

but in general, the number in front is OK - and as this makes the string more or less unmistakable to understand as a time refernce, be it in captitaIs or with dots in between, I wonder whether the whole effort is really necessary.  
And in none of the titles I found anything that desperately needed a particular case or spelling to get it right or remove a double meaning.  
On the other hand I found several 10,000 files that feature the first person singular of "to be" - and in these an "AM" instead of "am" would come as a surprise.

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [May 17, 2024, 12:27pm UTC](https://community.mp3tag.de/t/capitalisation-action/42131/11 "2024-05-17T12:27:45Z")

</div>

In addition to @ohrenkino's examples I would like to add the "artist intent". There are so many possibilities how an artist want to see his song title.

Just a random selection of "official" song title names from [MusicBrainz](https://musicbrainz.org/search?query=9+A.M.+&type=recording&limit=25&method=indexed) looking similar to `9 AM`  
All these titles are from different artists and different releases:

 ![image](https://community.mp3tag.de/uploads/default/original/3X/e/0/e062c676eec3cdff933dbd0139ea9216485f2817.png)

They are not named "wrongly", they just show the artist intent.  
Of course you can name your songs whatever you want. This is just one more opinion.

And BTW:  
What about AM in non-english languages like German:  
 ![image](https://community.mp3tag.de/uploads/default/original/3X/9/1/916889a3d9d9c0d364541f6453f117595d2be9f8.png)  
How would you write the "Am Donaustrande" (something like "On the banks of the Danube")

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [May 17, 2024, 12:38pm UTC](https://community.mp3tag.de/t/capitalisation-action/42131/12 "2024-05-17T12:38:05Z")

</div>

> [@djrip](#):
>
> Seems easier. I guess I just want to be able to automate as much as possible

IMHO the time you save with such an autoatic run is more than eaten up by removing all the wrongly transformed exceptions. I would perform such bulk modifications only on a set of files for which I have the control that they match the intended conditions 100%.

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [June 16, 2024, 12:38pm UTC](https://community.mp3tag.de/t/capitalisation-action/42131/13 "2024-06-16T12:38:23Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
