How to remove a dash and everything after it?

Greetings, I am new here and to Mp3tag overall. Spent about 3 hours browsing the forums. Got a few answers already to some other questions I had (How to remove "The" from the artists, and How to remove any feat. ft. etc. from the AlbumArtist). I wish to use tools to batch sort all the mp3 files each in its own AlbumArtist folder. But although I now know how to remove the "feat. + everything after it" using the Format Value: $regexp(%ALBUMARTIST%,'^(.+?)\s+[[({]?(?:ft.?|feat.?|featuring)\s+(?:[^][(){}]+)[])}]?(\s*.+)?$','$1$2',1), and most AlbumArtist values are "clean", some of them still have the additional artists in the field of AlbumArtist, separated with dashes. How can I remove the dahes and everything after them?

I see this: Usher-Lil Jon-Ludacris
I want to see: Usher

To keep only the first name/words (until the first dash) and delete all the rest. I understand that some artists have names that contain a dash, like Jan-Paul, or A-ha or Static-X. But they aren't that many, can fix them manually or filter them out before applying the action.
Is there anything I can add to the initial action (or create a new one) to accomodate the need above?

Select the Actions option from the Actions menu on the toolbar.
Click on the New action button and give the action a name.
Click on the New button.
Select the Guess values option from the Select action type menu.
Enter %albumartist% in the the Source format field.
Enter %albumartist%-%fileowner% in the the Guessing pattern field.
Click on the New button again.
Select the Remove Fields option from the Select action type menu.
type FILEOWNER in the field.
Click OK.

I use the fileowner field because it's not used, but you can use any field that accepts text input and is not being used.


If you do not want to preserve the information after the dash for closer later inspection, you can just use
%albumartist%-%dummy% als guessing pattern field.
This way you don't have to remove the help-field in an extra action.


Oh wow, I posted and went to bed, thinking it'll take hours, if not a few days, until someone responds. Thank you! Both suggestions work, just tested. Have a great day :slight_smile:


I frequently see contents in the field FILEOWNER in podcasts. So it would be advisable to check first if there are files that feature this standard field.

A better way to get rid of unwanted information is to use %dummy% (as @poster described) or to create a user-defined field like e.g. %remaining_persons% and then decide what to do with the extra information.

Well I can likewise select all files that need editing, and delete the File Owner tag from all, if any exist. Before I use jewahe's suggestion that is. All your input is helpful, thank you :slight_smile:

Now to figure out how to move the whole "feat. xxxxx" from the title tags to artist field and make each first letter uppercase, as they're names. But that's probably another topic for another day.

I didn't know it was possible to use dummy tags! That will make things much easier. Thanks!

this is my script for moving a featured artist from the title to the artist

Guess value: Source format: %title%; Guessing pattern: %title% (feat_ %fileowner%)
Guess value: Source format: %title%; Guessing pattern: %title% (with %fileowner%)
Case Conversion: Field Fileowner; Case Conversion: Mixed Case
Format value: Field Artists; Format String $IF(%fileowner%>0,%artist% featuring %fileowner%,%artist%)

Again, I use the fileowner field as a temp storage field and clear it at the end of the script.

You can use as many Guess Values actions as you need, depending on the structure of your file names. MP3tag will pick up the tags from the one that applies.

I had to replace feat_ with feat. for it to work, as in the ~30 files I tried it at once there's only "feat." in the title. However, it only works for some files. Some are not touched at all, and they have the same format: Title (feat. artist2) but leaves them untouched for some reason.

MP3tag is literal, so if you put in feat., it will only looks for feat with the period. You'll need a second guess values for files that don't use the period or parenthesis, or that might use square brackets [].

No no, I mean, all the title fields have "(feat. xxxx)" with a dot and inside parentheses, as you see it. But it only converted what it liked.

Also, it won't work if there's additional text after the (feat. %fileowner%) portion of the title (i.e., such as [Single]).

Yes there is additional text in all of them, thank you for pointing that out. Somehow the one I used for albumartist removal worked.


And it removed the featured artist names along with the parentheses. It seems to also work on fields without parentheses.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.