How to remove parentheses and move contents


#1

Hi all. As a newbie I have created 7 actions on my own and have searched the forum, but find I need help with this one. I have songs that display the number they charted at in the title:
Example: Born To Run (#45).
The numbers are different for each song. What expression do I use to remove the parentheses from the title field and move the pound sign and the number to the comment field preceded by the word charted
Example:
Title: Born To Run (#3) changed to
Title: Born To Run and
Comment: Charted #3
Thanks for your help. Paul


#2

You could use an action of the type "Guess values" for TITLE with the format string
%title% (%comment%)
This should move the stuff in brackets to comment. YOu would be missing the "Charted" though which you could easily add with an action as described in the FAQs:
/t/967/1


#3

Set Filter: TITLE MATCHES "^(.+?)\s((#\d+))$"

In one go ...
Action: Guess values
Source format: $regexp(%TITLE%,'^(.+?)\s((#\d+))$','$1===Charted $2')
Format string: %TITLE%===%COMMENT%

In two steps ...
Action: Guess values
Source format: %TITLE%
Format string: %TITLE% (%COMMENT%)

Action: Format value
Field: COMMENT
Format string: 'Charted '%COMMENT%

DD.20120616.0907.CEST
Edit.DD.20120618.1922.CEST


#4

Hi DetlevD,

Nice clean method for doing this task, could you tell me where this is documented in the help?

Also how do you make your expressions so nice and colourful? PS I've always wondered that but never asked. Thanks.


#5

Hi 'stevehero', the method to prepare the format of a string, which in turn fits to the guessing scheme to be applied, seems to be an evolvement from members of this forum.
It is simply word processing, cleverly applied.
I do not know who was the first one, Dano, pone, me, you?
An intensive forum recherche will find it out for sure.

For colorizing the Mp3tag scripting expressions I use an adaption of my WBT2HTML syntax colorizer.
Once the syntax rules of the programming language are defined, any other available programming language syntax colorizer can do it. Here in this case the output is written in BBCode.

Today nearly all good text editors support syntax colorizing, e. g. KEDIT, Textpad, Ultraedit, Notepad++.
Notepad++, with installed plugins and Mp3tag language support, can export Mp3tag scripting language to coloured RTF format.

DD.20120617.0818.CEST


#6

Wow! Thank you so much. As always, one solution leads to another question. How can I modify the string you gave me to work the same way if the title reads:

Title = Born To Run (#82-'67) changed to
Title = Born To Run and Comment = Charted #82

As you see, on some of the titles there is the year with a ' in front of it. I have studied and played with the string you gave me which works for about 90 % of my music, but I can't figure out the changes for this. Once again thank you.


#7

Set Filter: TITLE MATCHES "^(.+?)\s((#\d+)-.+)$"

In one go ...
Action: Guess values
Source format: $regexp(%TITLE%,'^(.+?)\s((#\d+)-.+)$','$1===Charted $2')
Format string: %TITLE%===%COMMENT%

In two steps ...
Action: Guess values
Source format: %TITLE%
Format string: %TITLE% (%COMMENT%-%DUMMY%)

Action: Format value
Field: COMMENT
Format string: 'Charted '%COMMENT%

DD.20120618.1922.CEST


#8

To handle both cases at once (from post #3 and #7)

Set Filter: TITLE MATCHES "^(.+?)\s((#\d+)(-.+)?)$"

In one go ...
Action: Guess values
Source format: $regexp(%TITLE%,'^(.+?)\s((#\d+)(-.+)?)$','$1===Charted $2')
Format string: %TITLE%===%COMMENT%

DD.20120618.1936.CEST


#9

Thank you sir. This works for nearly all of them. You have saced me hours of typing. You are the king