# How to remove a dash and everything after it?

**URL:** <https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604>\
**Category:** Support\
**Created:** [January 15, 2021, 11:48pm UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604 "2021-01-15T23:48:16Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chaleff](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@Chaleff](https://community.mp3tag.de/u/Chaleff)\
**Post date:** [January 15, 2021, 11:48pm UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604/1 "2021-01-15T23:48:16Z")

</div>

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?

Example:  
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?

---

<div class="post-metadata">

**Author:** ![jewahe](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/35a633/32.png) [@jewahe](https://community.mp3tag.de/u/jewahe)\
**Post date:** [January 16, 2021, 12:04am UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604/2 "2021-01-16T00:04:12Z")

</div>

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.  
Save.  
Click on the **New** button again.  
Select the **Remove Fields** option from the _Select action type_ menu.  
type **FILEOWNER** in the field.  
Save.  
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.

---

<div class="post-metadata">

**Author:** ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)\
**Post date:** [January 16, 2021, 7:29am UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604/3 "2021-01-16T07:29:07Z")

</div>

> [@jewahe](#):
>
> Enter **%albumartist%-%fileowner%**

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.

---

<div class="post-metadata">

**Author:** ![Chaleff](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@Chaleff](https://community.mp3tag.de/u/Chaleff)\
**Post date:** [January 16, 2021, 7:39am UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604/4 "2021-01-16T07:39:02Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [January 16, 2021, 9:36am UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604/5 "2021-01-16T09:36:10Z")

</div>

> [@jewahe](#):
>
> I use the fileowner field because it's not used,

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.

---

<div class="post-metadata">

**Author:** ![Chaleff](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@Chaleff](https://community.mp3tag.de/u/Chaleff)\
**Post date:** [January 16, 2021, 9:55am UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604/6 "2021-01-16T09:55:17Z")

</div>

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 🙂

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.

---

<div class="post-metadata">

**Author:** ![jewahe](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/35a633/32.png) [@jewahe](https://community.mp3tag.de/u/jewahe)\
**Post date:** [January 16, 2021, 2:57pm UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604/7 "2021-01-16T14:57:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jewahe](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/35a633/32.png) [@jewahe](https://community.mp3tag.de/u/jewahe)\
**Post date:** [January 16, 2021, 3:16pm UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604/8 "2021-01-16T15:16:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Chaleff](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@Chaleff](https://community.mp3tag.de/u/Chaleff)\
**Post date:** [January 16, 2021, 3:37pm UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604/9 "2021-01-16T15:37:18Z")

</div>

> [@jewahe](#):
>
> 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%)**

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.

---

<div class="post-metadata">

**Author:** ![jewahe](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/35a633/32.png) [@jewahe](https://community.mp3tag.de/u/jewahe)\
**Post date:** [January 16, 2021, 3:42pm UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604/10 "2021-01-16T15:42:04Z")

</div>

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 [].

---

<div class="post-metadata">

**Author:** ![Chaleff](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@Chaleff](https://community.mp3tag.de/u/Chaleff)\
**Post date:** [January 16, 2021, 3:45pm UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604/11 "2021-01-16T15:45:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jewahe](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/35a633/32.png) [@jewahe](https://community.mp3tag.de/u/jewahe)\
**Post date:** [January 16, 2021, 3:45pm UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604/12 "2021-01-16T15:45:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Chaleff](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a183cd/32.png) [@Chaleff](https://community.mp3tag.de/u/Chaleff)\
**Post date:** [January 16, 2021, 3:52pm UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604/13 "2021-01-16T15:52:41Z")

</div>

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

```nohighlight
$regexp(%TITLE%,'^(.+?)\s+[[({]?(?:ft\.?|feat\.?|featuring)\s+(?:[^][(){}]+)[])}]?(\s*.+)?$','$1$2',1)

```

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

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [February 15, 2021, 3:52pm UTC](https://community.mp3tag.de/t/how-to-remove-a-dash-and-everything-after-it/51604/14 "2021-02-15T15:52:45Z")

</div>

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