Move Part of Title


#1

Hi, I just joined the forum this evening. Great software and a very useful site, by the way. I've found lots of useful stuff here so far.

I've been trying to figure out how to solve a particular problem. I've found some posts in the FAQs that are close to what I want; but, as the scripting thing is very new to me, I can't figure out how to adapt them to suit my specific needs. So here's my situation:

I have hundreds of songs that are titled like this:

BWV589 Allabreve in D major,
BWV605 Der Tag der ist so freudenreich,

What I want is to have this instead:

Allabreve in D major, BWV589
Der Tag der ist so freudenreich, BWV605

I tried rearranging some song titles, like the above, using the 'replace with regular expression' action where I specified the parts of the song (i.e., (.*), etc., depending on how may parts there were) and then rearranged them (i.e., $2 $3 $1, etc.). This seemed to work. However, all of the song titles are of varying lengths. So, it doesn't quite seem to be the most efficient way to change hundreds of titles.

In short, I'd like to learn how to move the first part of the song title (i.e., the BWV number, which is different for each song) to the very end of the song title irrespective of how many parts there are in the title and regardless of the fact that each BWV number is different.

I'd be grateful if anyone could set me straight on this.


#2

Set Filter to:

TITLE MATCHES "^BWV"

There are several ways to reach the goal.
One way can be using the converter "Tag - Tag" together with a Regular Expression function ...

Convert | Tag - Tag | ALT+5

Select format string

Field:
TITLE

Format string:
$regexp(%TITLE%,'^(.+?)\s(.+?,)$','$2 $1')

Preview
From:
BWV589 Allabreve in D major,
To:
Allabreve in D major, BWV589

Another way can be using actions ...

Begin Action Group Test_2012#20120527.GuessValues

Action #1
Actiontype 7: Import tag fields (guess values)
Source format __: %TITLE%
Guessing pattern: %TMP1% %TMP2%

Action #2
Actiontype 5: Format value
Field ______: TITLE
Formatstring: %TMP2% %TMP1%

Action #3
Actiontype 9: Remove fields
Fields to remove (semicolon separated): TMP1;TMP2

End Action Group Test_2012#20120527.GuessValues (3 Actions)

Another way can be using action "Replace with regular expression" ...

Begin Action Group Test_2012#20120527.GuessValues.2

Action #1
Actiontype 4: Replace with regular expression
Field ______________: TITLE
Regular expression _: ^(.+?)\s(.+?,)$
Replace matches with: $2 $1

[_] Case sensitive comparison

End Action Group Test_2012#20120527.GuessValues.2 (1 Action)

DD.20120527.1325.CEST


#3

Hi, thanks so much for your thorough explanation and quick response. I used the first method, and it worked absolutely beautifully! Cheers!