Action group to captitalize Roman numerals

Here is an .mta rules file (attached) that will captitalize Roman numerals I through XXX in file tags.

e. g.:
Before: Vi. Visitation from Alpha vI

After: VI. Visitation from Alpha VI

Note that "Vi" in "Visitation" is preserved while Roman numerals are correctly capitalized

Installation:

  1. If MP3Tag is running, close it
  2. Copy the Numerals.mta file to your MP3Tag folder (e. g. C:\Documents and Settings[username]\Application Data\Mp3tag\data\actions
  3. Re-run MP3Tag
  4. Select audio file(s) with Roman numerals in the tag
  5. Select the "Actions" from the Convert menu
  6. Enable the checkbox for the "Numerals" rule.
  7. Click OK

Here is the basic template:

Find: (^|\s)[v|V]i|I

Replace: $1VI$2

Explanation:

Find: detect any case of 'VI' ([v|V] [i|I]), with either a leading (^) space (\s) or trailing ($) space or both, or a trailing period (.) in case of 'VI.'

Replace: Preserve any leading text ($1), replace 'Vi' with 'VI' and also preserve any trailing text ($2).

If you like your numerals in lower case, you'll need to change the Replace in each rule to lower case, such as: $1vi$2

MANY MANY MANY thanks to the MP3Tag developers for giving me hours of my life back!

Numerals.mta (1.87 KB)

Why not

FIELD: TITLE

REG. EXP.: (\s+)([iIvVxXmMlLdD]+)(\s+|$)

REPLACE: $1$upper($2)$3

Maybe this one could help: Regular Expressions

Is there a way to modify the expressions to also catch this situation?

Act IX: The End

i.e. where the numeral is immediately followed by any punctuation (including parentheses) not just space or full stop.

You can try this Regular Expression:

(?=\b[MCDXLVI]{1,6}\b)M{0,4}(?:CM|CD|D?C{0,3})(?:XC|XL|L?X{0,3})(?:IX|IV|V?I{0,3})

Adjust the TITLE field in this example to suit your needs:
Roman Numerals

If you want to test some more Roman Numeral variations: regex101: build, test, and debug regex

That didn't work for me as it picks out parts of actal words, however the website link was really useful to help understand what is going on!

I have settled on using the original MTA but adding a \W alternative at the beggining and end. This seems to work for my test cases but I'll probably find something it does wrong later!

1 Like

Please let us know your solution once you are happy with it.

My modification attached below.

Roman.mta (2.2 KB)

The intention is to add a check for any non-word character before/after, not just a space or full stop.

1 Like

May I ask:
Do you have a specific reason why you enable the "case-sensitive comparison" option and as a consequence have to list all the lower- and uppercase variations like (^|\s|\W)[x|X][x|X][v|V][i|I][i|I][i|I](\s+|\W|$)

I didn't do this intentionally :grinning:

I just edited the MTA file from the original post in an external text editor to (hopefully) work as I want it to.