Insert Track Number Into Title


This should be simple but does not work. I would like to insert into the TITLE tag the track number. Currently there is a dummy string "#" in the title tag and I wish to replace it with the actual track number. I'm using the Replace with Regular Expression, where "Field" = "TITLE", "Regular expression" = "#", and "Replace matches with" = "$num(%track%,3)". This returns a value of '000'. I'm expecting the actual value of the track number padded with two zeros. How can I get this to work?

Thanks. <_<


Well, it doesn't work the way you want, AFAIK. If you want to add a track number at the beginning of the title field, simply replace "#" by nothing and add another action which formats values. Use TITLE as field and "$num(%track%,3) %title%" as format string.


Are you saying I cannot insert the track number in the middle of the TITLE string using Mp3tag? Does Mp3tag have an enumerate function which would apply to a selection of files/tags? Something like $enum(x,y), where x=starting value, and y=increment. Also, the ability to create variables which are based on information in tags would be nice.



I don't know if I understand this right, but you can try FORMAT VALUE on TITLE with:


Thanks dano!

This is very close. If I start with this title: "Sonata in D Major, K. # -- Allegro" and apply your expression, I get "Sonata in D Major, K. 161Major, K. # -- Allegro". The result should be "Sonata in D Major, K. 161 -- Allegro".


Ok, I didn't look what $right really does :wink:
Sp replace



This worked beautifully. Brilliant, you saved me much work. Where can I learn more about scripting for Mp3tag?



In Mp3tag, press F1 and you see the Help.
There's a link to the scripting reference.