Replace last comma in title with colon

Hi

with classical music, I often get a mix of different ways, a title is written.
xxxx, xxxx, op.2, I. Largo
or
xxxx op. 2, I. Largo
Is there a way, I can always just address the LAST comma in the title (no matter, how many commas the title contains) and replace it with a colon ?
Thanks for you help!

You could try Convert Tag -> Tag with
$regexp(%title%,',\s*(?!.*,)',': ')

Examples:
xxxx, xxxx, op.2, I. Largo
--->
xxxx, xxxx, op.2: I. Largo
or
xxxx op. 2, I. Largo
--->
xxxx op. 2: I. Largo

The regular expression
,\s*(?!.*,)

works as follows:

  • , → matches a literal comma.
  • \s* → matches zero or more whitespace characters after the comma.
  • (?!.*,) → negative lookahead: verifies that there is no other comma anywhere to the right of the current position.

As a result, only the last comma in the string is matched.

We can provide more specific suggestions if you show us complete, real-life examples.

As there are many ways to skin a cat, here an alternative:
$regexp('xxxx, xxxx, xxxx, op.2, I. Largo','(.*), (.*?)',$1: $2)

Thank you very much - that does the trick!
Especially thank you for explaining, how that regexp works: that makes me understand and hopefully be able to apply that lookup for a "last character" to other use-cases!