How to copy PORTION of one field to another?

Is there any way to apply a regular expression to one field, and then use the results of that regular expression (through parenthesized sub-expressions) as changes to be made in another field?

For example, let's say I have tracks titles that have:

My Title (Track 1) My Title 2 (Track 2) My Title 3 (Track 90)
And I have a regex:
^[^(]*\(Track ([0-9]*)\)$
And I want to set the value for the TRACK field to '\1' from the above expression as applied to the TITLE field.

Is there a way I can do this? Also, is there a way to extract values from MULTIPLE fields to use in modifying a target field?

Something like that would be truly wonderful.

  • Tim

You can copy content from one tag to another tag, e. g.
Actiongroup: Copy content from one tagfield to another tagfield
Action #1
Actiontype 5: Format tag field
Field: TAG_2
Formatstring: %TAG_1%

You can run any action against the new tagfield.


Hi there, DetlevD...

Well, that is a related thing, but it's not extracting content elements from one tag and transforming a second field based on them.

Say I had one field that had "ABC DEF 123" in it, and another field that had "XYZ HAHAHA 999", and I wanted to copy the digits at the end of the 2nd field and replace the 1st field's digits with them. That kind of thing is not doable with mp3tag, correct?

  • Tim

Proposal, quick and dirty, not tested:

TAG_1 use Format
"ABC DEF 123"

TAG_2 use Format

TAG_3 use Format

TAG_1 use RegExp
"ABC DEF 123" manipulate it to "123" e. g. $regexp(TAG_1,^(.?)(\d)$,$2)

TAG_2 use RegExp
"ABC DEF 123" manipulate it to "ABC DEF " e. g. $regexp(TAG_2,^(.?)(\d)$,$1)

TAG_3 use RegExp
"XYZ HAHAHA 999" manipulate it to "999" e. g. $regexp(TAG_3,^(.?)(\d)$,$2)

TAG_4 use Format

You may be able to reduce the number of tag fields.


Thanks, D -- I'll give those ideas a try -- I appreciate the thought you put into it.
Do you happen to know if there is a tagging program that supports this kind of really complex
transformations with regular expressions built in, so that you needn't come up with
a strategy to do this based on multiple steps or intermediary tags?

  • Tim
Moderation: removed unnecessary fullquote

I would solve this special problem with Mp3tag this way:

Begin Actiongroup Test_tbessie

Action #1
Actiontype 5: Format tag field
Field: TBESSIE_1
Formatstring: ABC÷DEF÷123

Action #2
Actiontype 5: Format tag field
Field: TBESSIE_2
Formatstring: XYZ÷HAHAHA÷999

Action #3
Actiontype 5: Format tag field
Field: TBESSIE_3
Formatstring: %TBESSIE_1%,%TBESSIE_2%

Action #4
Actiontype 4: Replace with regular expression
Field: TBESSIE_3
Regular expression: ^(.?)(\d),(.?)(\d)$
Replace matches with: $1$4

[_] case sensitive comparison

Note: Replace one special character ÷ with one space character.
End Actiongroup Test_tbessie (4 Actions)

This actiongroup gives the result TBESSIE_3=ABC DEF 999.