Please help with another special regular expression

Well, thanks for the help with the "in" before Dur/moll, just works perfectly the way you told me...

There are two problems left, one of which I think you can solve, the other will be unsolvable.

Problem 1:

Some track names I get from Amazon or freedb have "in B" at the end of the filename, just before the file extension. I want to catch those and replace them with "in H-Dur" (if capital B of course). otherwise to "in h-moll". I could solve all cases in which this expression shows up somewhere else in the filename, just the end of line case is a problem.

I want to exclude the cases in which it already has a Dur or moll signature.

Additionally it should also replace "in B flat" to "in B-Dur" and "in fis sharp" to "in fis-moll". So also the expressions "flat/bemol" and "sharp/#/diese/dièse/diesis/sostenido" should be honored correctly. Then all common key signature languages (eng/fra/ita/esp) are included. I think the simplest way would be to first replace all these special ending values into "flat" or "sharp" and then process one expression which does the formatting of the value

Problem 2 (which I think is unsolvable):

The formatting I receive from Amazon or freedb looks like this
01 - String Quartet No 14 in d-moll, D 810 - Allegro
02 - String Quartet No 14 in d-moll, D 810 - Andante con moto
03 - String Quartet No 14 in d-moll, D 810 - Scherzo: Allegro molto
04 - String Quartet No 14 in d-moll, D 810 - Presto
and I would like to have it like this
01 - String Quartet No 14 in d-moll, D 810 - I - Allegro
02 - String Quartet No 14 in d-moll, D 810 - II - Andante con moto
03 - String Quartet No 14 in d-moll, D 810 - III - Scherzo: Allegro molto
04 - String Quartet No 14 in d-moll, D 810 - IV - Presto

That would mean that I can do a roman number sequencing action in consecutive tracks I highlight. Until now I have to do all this manually, which is very time consuming :slight_smile:

And to make it even more difficult, it would be very cool to be able to solve "elimination of same string elements from second occurrence on", so that it looks like this
01 - String Quartet No 14 in d-moll, D 810 - I - Allegro
02 - II - Andante con moto
03 - III - Scherzo: Allegro molto
04 - IV - Presto

Appreciate your help!
Thanks
:laughing:

where are the 'Regular Expression Geeks', who can help??
:slight_smile:

A club-mate always says, if you are looking for a helping hand, then look at the end of your arm.

Regex: Roman numerals in uppercase
Regular Expressions

Converting roman to arabic number and vice versa, - implemented as action groups -
Converting roman to arabic number and vice versa

All music related knowledge stuff is up to you.
G flat = Ges
G sharp = Gis
English B = German H
http://en.wikipedia.org/wiki/Note

"Elimination of same string elements on repeated occurrences"
This might be possible by tricky usage of Mp3tag export scripting language, but never did it before, so the current status of this wish will be "impossible" further on.

DD.20101024.1935.CEST

Actiongroup:

  1. Format Value:
    Field:
    TITLE
    Format String:
    $regexp(%title%,(.?) - (.?) - (.),$1) - $if($eql($left(%title%,2),01),$regexp(%title%,(.?) - (.?) - (.),$2 - $1),$regexp(%title%,(.?) - (.?) - (.),$1)) - $regexp(%title%,(.?) - (.?) - (.),$3)

  2. Replace with regular expression:
    Field:
    TITLE
    Regular Expression:

  • (\d\d) -
    Replace matches with:
  • $replace($1,01,I,02,II,03,III,04,IV,05,V,06,VI,07,VII,08,VIII,09,IX,10,X) -

works for roman numbers I-X, but you can append as many numbers as you need in the last string.

EDIT:
Problem 1 sounds simple:
Include for every every key-signature which sould be changed something like this:

Action: Replace
Field: TITLE
Original: in B
Replace with: in H-Dur

will be a lot of work for 4 different languages and the different key signatures.

Thanks for your hints... but...

It's not that simple...

It's just the "end of line" situation which is tricky. Within a title value I wrote different replacement actions (for every different language and also for the short values)

The problem is that I don't want to make out of
performed in Bratislava
a
performed in H-Durratislava

Wouldn't make much sense

So for the short signatures I check "in B " (with a space) or "in B," and replace it with H-Dur

The end of line situation is the problem... (before the file extension)

I want to check if the string terminates with "in X" (X can be 1-3 characters wide) and if X begins with a capital letter then add a " major", with a lower case character a " minor"

Then I can replace with my english to german action easily
:slight_smile:

And thanks for your suggestion of the numbering problem...

It doesn't work

Because it just works if the track numbers are 01 to 04... but what if the tracks of these four movements are 07 to 11?

Anyway, I thought it will be not to solve
But thanks for the nice hint :slight_smile:

The only way to solve this problem would be if you could refer to the previous track title and depending on the roman number you set there you would set the next roman number in the actual line value... hope that this was understandable, lol

A filter string could look like this (case sensitive):

"%_FILENAME%" MATCHES "(?-i)in (Ces|Ges|Des|As|Es|B|F|C|G|D|A|E|H|Fis|Cis|as|es|b|f|c|g|d|a|e|h|fis|cis|gis|dis

|ais)$"

A filter string could look like this (case insensitive):

"%_FILENAME%" MATCHES "in (a|ais|as|b|c|ces|cis|d|des|dis|e|es|f|fis|g|ges|gis|h)$"

A filter string could look like this (case insensitive):

"%_FILENAME%" MATCHES "in (((c|d|g)((e|i)s)?)|(a(is|s)?)|(es?)|(f(is)?)|b|h)$"

Testfiles:
20110104.Test.Tonarten.zip (6.84 KB)

DD.20101028.1931.CEST
Edit.DD.20110104.1552.CET

20110104.Test.Tonarten.zip (6.84 KB)

Ah, ok, I thought Roman I always coresponds to Arabic 1. I'll think about it.

Problem 1:

$ matches the end of a line, so check for "in B$"
you can also check for alternatives with "|". this would be perfect for you:

$regexp(%title%,in B($| |','),in H-Dur$1)

Problem 2:
Format the Title with this string:
$regexp(%title%,(.?) - (.?) - (.*),$1 - $if($eql(%_counter%,1),$2 - I,$replace(%_counter%,1,I,2,II,3,III,4,IV,5,V,6,VI,7,VII,8,VIII,9,IX,10,X)) - $3)

BUT: You can't format the whole album at one go. You have to do it separately for every Roman number sequence.