Tags: Exporting Only a Portion of One Field to Another

If possible, how do I export only a portion of the description in a tag field to another field? The string I wish to export is continuous, but it may vary in the number of characters and its position within the tag field- mostly the position will be at the beginning or at the end of the tag field.

A typical example would be where I would like to export the Composer of a song from the Title Field and move or copy it to the Composer Field. Here are two titles with the Composer at the beginning of the title, but it could be positioned anywhere else.

  1. Verdi: Preludio Atto I (La Traviata)
  2. Mozart: Madamina, Il Catalogo E Questo (Don Giovanni)
Thank you.

You may apply an action "Guess values" with a fitting pattern, which may vary depending on the given format of the TITLE string.

Action "Guess values"
Source format: %TITLE%
Guessing pattern: %COMPOSER%:%DUMMY%

From:
TITLE = Verdi: Preludio Atto I (La Traviata)
To:
TITLE = Verdi: Preludio Atto I (La Traviata)
COMPOSER = Verdi

See also ...
https://www.google.de/search?q=site%3Aforum...de+Guess+values

For a sophisticated example see there ...
/t/12651/1

DD.20150720.1718.CEST

Thank you very much DetlevD. I am going to apply it to learn how it works.

I have applied your proposal DetlevD, and it worked just fine in this particular instance. However, what if there are no discernible characters available in the field, for example no punctuation marks such as the colon after the name of the composer? Example:

  1. Verdi Preludio Atto I (La Traviata)
  2. Mozart Madamina, Il Catalogo E Questo (Don Giovanni)
Thank you.

You have different options to "repair" this initial situation ...

  • Use as the first split point the space character behind the artist name "Verdi".
    Action "Guess values"
    Source format: %TITLE%
    Guessing pattern: %COMPOSER% %DUMMY%
    This works for one word composer names only.

  • At first rename "Verdi" to "Verdi:" ... or something alike, ... then guess values ...
    Action "Guess values"
    Source format: $replace(%TITLE%,'Verdi ','Verdi:')
    Guessing pattern: %COMPOSER%:%DUMMY%

  • There might be other textual tricks possible ...
    Action "Guess values"
    Source format: $replace(%TITLE%,'Verdi ',':Verdi:')
    Guessing pattern: %DUMMY%:%COMPOSER%:%DUMMY%

DD.20150720.1731.CEST, DD.20150720.1822.CEST

Thank you DetlevD. Will a regular expression not achieve what I need to do? If there is a way to build to a regular expression to cover most instances of what I need to do, I will surely appreciate a few working examples. :slight_smile:

Yes, you have to describe and lay out all different cases, in order to create and get at last an universal regular expression, if ever possible.
I assume that the basic problem remains the same, ...
which is the need of having distinct separator characters, ...
or systematically structured string data, ...
to describe where to split resp. what to extract.
See also links in post #2 above.

DD.20150720.1813.CEST

I agree and thank you for you for your guidance, DetlevD. I appreciate it.

There is one more thing I need help with, please:

From my earlier examples:

Verdi: Preludio Atto I (La Traviata)

How do I move the name "Verdi" in the beginning of the field to the end of the same field, and if "Verdi" was at the end, how do I move it to the front?

Thank you.

[Edit] I found this which I am going to try :slight_smile:

Consider this ...
TITLE = Verdi: Preludio Atto I (La Traviata)

Formatstring: %TITLE%', '%TITLE%

'Verdi: Preludio Atto I (La Traviata)' + ', ' + 'Verdi: Preludio Atto I (La Traviata)' Action: Guess values Source format : %TITLE%', '%TITLE% Guessing pattern: %DUMMY%: %TITLE%:%DUMMY% TITLE = ... From: Verdi: Preludio Atto I (La Traviata) To : Preludio Atto I (La Traviata), Verdi Action: Guess values Source format : %TITLE%': '%TITLE% Guessing pattern: %DUMMY%, %TITLE%,%DUMMY% TITLE = ... From: Preludio Atto I (La Traviata), Verdi To : Verdi: Preludio Atto I (La Traviata)

DD.20150721.1624.CEST

Thank you once again, DetlevD, you have once again saved the day. I did try to figure it out on my own before your response, but I failed miserably at it. Cheers. :music:

I experimented on my own to rearrange the TITLE description, but I failed to adapt your examples to get the desired result. Using our previous example, I would like to rename it thus:

TITLE = Verdi: Preludio Atto I (La Traviata)
to:
TITLE = Preludio Atto I (La Traviata) {Verdi}

My best effort delivered this result:
TITLE = Preludio Atto I (La Traviata){} Verdi

- using Source Format: %TITLE%' {} '%TITLE%

Where did I go wrong?

I think that the the "Guess values" action is not always the best to manipulate one field.
For your example I could think of at least 2 approaches.
One uses the "Guess values" again but moves the "Verdi" to composer first:
Guess value for TITLE:
Guessing pattern: %composer%: %title%
and next perform an action of the type "Format value" for TITLE:
Format string: %title% {%composer%}

Alternatively, you could do without filling composer and move the part in front of the colon to the parenthesis:
"Replace with regular expression" for TITLE
Search string: (.): (.)
Replace string: $2 {$1}
If you want to transform one pattern into

The basic rule is ... divide a complex task into several steps of less complexity.
Once the text ...
"Verdi: Preludio Atto I (La Traviata)"
has been converted to ...
"Preludio Atto I (La Traviata), Verdi"
by the "guess values" proposal ...
then format the composer name ... from ", Verdi" to " {Verdi}".

This can be done for this special case by ...

Action: Format value Field : TITLE Formatstring: $replace(%TITLE%,', Verdi',' {Verdi}')

... or more general ... using a regular expression ...

Action: Format value Field : TITLE Formatstring: $regexp(%TITLE%,',\s*(.+?)$',' {$1}')

DD.20150721.2006.CEST

If you want to do it all in one go, then try the following regular expression ...

Action: Format value Field : TITLE Formatstring: $regexp(%TITLE%,'^(.+?):\s*(.+?)$','$2 {$1}') From: Verdi: Preludio Atto I (La Traviata) To : Preludio Atto I (La Traviata) {Verdi}

... and the other way round ...

Action: Format value Field : TITLE Formatstring: $regexp(%TITLE%,'^(.+?)\s*{(.+?)}$','$2: $1') From: Preludio Atto I (La Traviata) {Verdi} To : Verdi: Preludio Atto I (La Traviata)

DD.20150721.2026.CEST

Thank you to you both, ohrenkino and DetlevD. I deeply appreciate your time and help.

Your message seems to have been truncated, ohrenkino.

I will take me some time to digest and test all your recommendations. Thanks again.

Yes and no: that is a leftover from a former idea and apparently I did not scroll to the end before I clicked send.
So in short: thanks but please ignore that sentence.