Part filename used in tag

OK – so now I realise how good this program is for Karaoke file naming.

What I need to do is to retag from filenames – but only use part of the filename. (in the early days my tagging and filenaming were not so good)

i.e. filename is My Way – Frank Sinatra – disc 12345

I do not want to use the track title and artist (these are all very correctly tagged and sometimes the filemaes are not) I just want to add “disc 12345” to the comments tag.

Not all filenames may have three sections – it would be good if I could filter only those that have three sections ie two lots of “ – “

Any help would be appreciated.

All the best

Create action group: 'Append 'disc 12345' to COMMENT'
Create action:
Action #1:
Action type: Format value
Formatstring: %COMMENT%$regexp(%_filename%,'^(.)( – disc \d+)(.)$','$2')

Run this action group against one file and see if the result is that what you want.
If ok, then run this action group against your selected files.

The action works as follows:
Assuming existing comment string 'This is a comment.'.
The action searches the filename string for a substring looking like e.g. ' – disc 12345'.
If there is a search result, it extracts the substring and appends it as is to the comment string.
Afterwards the comment string looks like: 'This is a comment. – disc 12345'.
If the substring cannot be found, the comment string will be left as is.


Thanks for the quick reply.
Seemed to work in part. the action only changed the "Comment" part of the tag.
But put the whole of the filename "My Way – Frank Sinatra – disc 12345 " into the comment tag.

It does not seem to locate only the information after the second " - "

Please excuse me if I have missed something.

Just to clarify the third part of the filename could be anything "SF1234-45" "THM0701-13" "zmp121-12". It would not always be prefixed by the word "disc". It will always be the third part of the filename.

The problem is, that you obviously use nearly same looking dash and hyphen characters and now you use the hyphen character differently than in your posting before.
Your example string was 'My Way – Frank Sinatra – disc 12345'.
In my example I did use use your dash '–', now you want a hyphen '-', these are two different characters and you have to adapt this by yourself.
You may try this action:
Action #1:
Action type: Format value
Formatstring: %COMMENT%$regexp(%_filename%,'^(.)(–|-) (disc \d+)(.)$',' - $3')

Well, this behaviour I did not expect, and I really do think, that it is a bug in the regexp machine. Maybe I am wrong, who knows it better and can help?
If a grouping set (tagged expression) cannot match, then the corresponding $n referrer should be set to an empty string. And in the case we use this one $n referrer in the replacement part of the $regexp function parameterlist, the function should return the empty string, not the complete input string. * Altered opinion: see down entry DD.20070125.1155 *

You may use the filter function in the Mp3tag user interface and let display only these files that contain the substring ' – disc' or ' - disc'.

It is always helpful to know what is desired.
So you have to be particular on describing your problem and try to write down all requirements and tasks completely. I became suspicious that the 'dash test' was not the last surprise by you.


Well, I think I do understand the regexp problem.
If there is no regexp match, then there is no $n referrer, and the complete unchanged input string is the result.
Here we go:
Action #1:
Action type: Format value
Formatstring: %COMMENT%$if($eql(%_filename%,$regexp(%_filename%,'^(.)(–|-) (disc \d+)(.)$',' - $3')),%DUMMY%,$regexp(%_filename%,'^(.)(–|-) (disc \d+)(.)$',' - $3'))


Sorry so long to reply but lost internet connection for a day.
You have done a lot of work for me, thank you.
The last formatstring
%COMMENT%$if($eql(%_FILENAME%,$regexp(%_FILENAME%,^(.)(–|-) (disc \d+)(.)$, - $3)),,$regexp(%_FILENAME%,^(.)(–|-) (disc \d+)(.)$, - $3))
actually does not seem to do anything.

I am sorry that I may not have been as clear as I could have been.

To start over: I have a lot of karaoke tracks converted from discs years ago.

The filename follows the format
Title – (space hyphen space)Artist Name - (space hyphen space)Comment

All are tagged with the title and artist name 100% - I used to do this manually. But I never added the “comment”. Sometimes I did not add the “comment” to the filename.

Sometimes the artist name within the filename is not 100% correct. For instance I have some F. Sinatra and some Frank Sinatra. Over the years I have manually changed the tags so that all the artist tags for Mr. Sinatra’s songs would be Frank Sinatra. This is why I do not want to use the normal renaming option of “filename-tag”

(As I began to understand “tagging” all the later discs I converted were tagged correctly.)

You could just try the string
%dummy% - %dummy% - %comment%
with this tool.

:stuck_out_tongue: It is always helpful to know what is desired.

Tried the string
%dummy% - %dummy% - %comment%

this returns " - - " (space hyphen space space hyphen space)

I have to say that, although we have not found the solution yet, it does show that it is possible.

thanks again

My string is for "Convert > filename - tag" and not for an action.

Yes, Yes, Yes!!!!!

So simple - when you know how.

Thanks to everyone.

Keep singing

In retrospect to this thread I want to say that dano's proposal using "Convert > filename - tag" was the same idea I had thougt of in the beginning.

But there was the requirement specified by KaraokeK 'I just want to add “disc 12345” to the comments tag.'
Reality is, that adding something to an existing tag content is quite impossible using "Convert > filename - tag".

If KaraokeK would have said 'I just want to set “disc 12345” to the comments tag.', then he would have got the solution in a twinkle of an eye using "Convert > filename - tag", and maybe, as a menu driven Mp3tag ready-built-in functionality, he could have easy find out this for himself.

And additionally, at first KarakokeK did not say that there were different cases of filename formats to handle, and later I was thinking he wanton tends to make his problem even a bit more complicated step by step.

This thread is a typical example for communication misunderstanding, so I have to repeat:
It is always helpful to know what is desired.

Have a good time ...


Hi DetlevD
Sorry to take time to reply but I have been away.

I am sorry that I did not explain myself as well as I could have. Definitely a case of my brain knowing what I want but my fingers not typing the same. I always have the utmost respect for you guys who try to help those of us that are not as savvy as they should be.
Again, thanks for everyone who helped this time.