How to lowercase prepositions

Good morning.
I'm using an action to transform the preposition to lowercase.
Using the three rules below, I was able to do this for single words, and for words after the "-".
How do I, or how would the action be, to transform into lowercase, words that come before (that is, that precede) punctuation and special signs:
: = > . , ; ) ] }
Anarchic System - See Me, Hear Me.mp3
(change to)
Anarchic System - See me, Hear me.mp3

(?<=\w\s)(a|an|as|at|and|but|by|de|for|from|in|it|me|nor|of|off|on|onto|or|so|the|to|up|yet)(?=\s) => lower($0)
(?<=\w\s)(a|an|as|at|and|but|by|de|for|from|in|it|me|nor|of|off|on|onto|or|so|the|to|up|yet)($) => lower($0)
(?<=\w\s)(a|an|as|at|and|but|by|de|for|from|in|it|me|nor|of|off|on|onto|or|so|the|to|up|yet) => lower($0)

I got:
Anarchic System - See Me, Hear me.mp3


You want to write all the letters and words from this list
always in lowercase, if they are followed by one of this characters?
: = > . , ; ) ] }

To get for example:

Say A.mp3
-> Say a.mp3

Say A).mp3
-> Say a).mp3

Say A. point.mp3
-> Say a. point.mp3

The: One
-> the: one.mp3

1 Like

Yes, because it is a preposition.
My Life Is (The) Love => My Life Is (the) Love
See Me, Hear Me => See me, Hear me
This Is [THE] Love Of My Live => This Is [the] Love of My Live

I don't want to capitalize the prepositions/words below:

a an and as at but by de for from in into it me nor of off on onto or so the to up yet

I would have thought that if you want to replace 1 string constant with another, then a simple replace would be enough: Action of the type "Format value" for _FILENAME
Format string: $replace(%_filename%), A , a , An, an)
(and up to 30 more pairs).
The problem of capitalized words following non-alphabetical characters can be handled with an action of the type "Case conversion" in which you can say which characters should be treated as word boundary - and if you set only the space character, then every other character would lead to a lower case character. This action should be run first, followed by the replace function.

I wonder when : and > should appear in a filename ... AFAIK the : is only valid to separate the drive letter and the > is used to redirect output to a file.

Just a word on language:
According to this site, there are 150 prepositions.

Your list is missing some of them but features some words that are no prepositions.

1 Like

Good morning!
I also use it in the %title% field, not just the filename.
Just as I convert '' to ',' I also convert ':' to ';'
In fact, I needed to know which symbol represents "any character", just like in windows explorer it is represented by '?' for any character (except space). So I would use (a|an|the)(?)
I already learned that space is represented by (\s) and letter by [a-z].
I don't know if [a-z] only represents a lowercase letter or if it represents both lowercase and uppercase, and I don't know if there is a way to represent only characters like ( ] ? at the beginning and end of the word, ex: [The The}
How to represent any accented letter (é ã ç ñ).
These "basic" things would make it easier for us to create the conversion rules.

I recommend to read a Regular Expression Tutorial like this.
There is no specific symbol for "any character except space". But you can combine them to [^ ]
(Please be aware that "anything" would also include a tabulator, line breaks, hard spaces...)

There is one for "any character", a dot .
And there is one for a space \s

Yes. If you want to include uppercase characters too it would be [A-Z]. Combined [a-zA-Z].

The beginning of a string is represented by a ^
The end of a string is represented by a $
Some people call them anchors.

There is no easy way for this because there a countless combinations out there.

All this has nothing to do with Mp3tag. Please read one or more tutorials about regular expressions.

Little snippet from the second tutorial:

Also the documentation for Mp3tag offers some basic introduction:

1 Like

My friends, thank you very, very much for the tips and the links.
With these tips and the tips from the links, I did it.
I created two examples for testing, and it worked:
(The) The, There (The).
The There The, The The.

After using the actions at the end of this text (below), it looks like this:
(The) the, There (the).
The There the, the the.

These are examples that don't exist, just to test, because many titles are in my language (Brazilian Portuguese).

Replace With Regular Expression

Regular Expression:
Replace Matches With:

Regular Expression:
Replace Matches With:

Regular Expression:
Replace Matches With:

This part: (?<=\s)
In all expressions it is necessary, so that the first word of the %title% is not lowercase, even if it is in parentheses.

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