Author Topic: Arabic to Roman numbers.  (Read 407 times)

aktor

  • Sr. Member
  • ****
  • Posts: 336
Is there a automatic way to change titles that have Arabic numbers to a Roman numbers without editing every title separately?

Messiaen

  • Jr. Member
  • **
  • Posts: 114
There are many ways, but I found it easier to just use the AT/RT plugin and create a preset such as:

Search for: ^(.*?)(\d+)(.*)$
Replace with: $1\@eval[[$RomanNumerals($2)]]$3

Of course it's entirely possible boroda's already created a preset for this (it's been awhile since I looked through the whole list), and I'm just living in the past, but this is one method.  (Note: it will only convert the "first instance" of an arabic numeral set, not others, but that covers most needs.)
Last Edit: January 27, 2025, 11:48:17 AM by Messiaen

aktor

  • Sr. Member
  • ****
  • Posts: 336
Can you modify the formula so that it only change the format id the number is after : or : (space)

Messiaen

  • Jr. Member
  • **
  • Posts: 114
Search for: ^(.*?[:\s])(\d+)(.*)$

Note the "[:\s]" after the first "*?" - anything in that group will be used as a "start here" indicator.

For example, a title like String Quartet #1, Part 23 will convert only the 23, not the 1.  For edge cases like these it's sometimes easier to just make multiple rules... ("first occurrence of", "last occurrence", "all occurrences", etc.).  I don't claim to be a regex guru, so others might come up with a better, more compete, method.

aktor

  • Sr. Member
  • ****
  • Posts: 336
For clarification:
from this: Five Movements Op. 5 - Version For String Orchestra (1929): 4. Sehr Langsam
to this: Five Movements Op. 5 - Version For String Orchestra (1929): IV. Sehr Langsam

your formula:
Five Movements Op. V - Version For String Orchestra (1929): 4. Sehr Langsam




Messiaen

  • Jr. Member
  • **
  • Posts: 114
Ah, yes.  You could just remove the [] themselves and keep the :\s

^(.*:\s)(\d+)(.*)$
Last Edit: January 27, 2025, 02:00:26 PM by Messiaen