Nur 'mal so als erster Versuch:
$caps($regexp($lower(%TONART%),^('['a-g']')\s(m(aj|in)or)$,$1-$2),-)
mit %TONART% = 'a miNor'
ergibt es: 'A-Minor'
DD.20080223.1654.CET
... und ein zweiter Versuch:
$caps($regexp($replace($lower(%TONART%),'-flat ','b ','-sharp ','# '),^('['a-g']''['b#']'*)'['\s|-']'(m(aj|in)or)$,$1-$2),-)
oder
$caps($regexp($replace($lower(%TONART%),'-flat ','b ','-sharp ','# '),'^([a-g][b#]*)[\s|-](m(aj|in)or)$',$1-$2),-)
Beispiele:
'a-major' ==> 'A-Major'
'g-minor' ==> 'G-Minor'
'a major' ==> 'A-Major'
'g minor' ==> 'G-Minor'
'ab-minor' ==> 'Ab-Minor'
'a#-major' ==> 'A#-Major'
'ab minor' ==> 'Ab-Minor'
'a# major' ==> 'A#-Major'
'a-FLAT miNor' ==> 'Ab-Minor'
'a-ShArP mAJor' ==> 'A#-Major'
DD.20080223.1711.CET