# Trim some contributing artist from filename

**URL:** https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660
**Category:** Support
**Created:** [January 7, 2010, 10:35am UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660 "2010-01-07T10:35:59Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![kimosapiens](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/eb9ed0/32.png) [@kimosapiens](https://community.mp3tag.de/u/kimosapiens)
#### Post date: [January 7, 2010, 10:35am UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/1 "2010-01-07T10:35:59Z")

</div>

Hi !

How do I trim the filename to make it show only the first artist from a list of contributing artists ?

Example:

```
              Original Artists: Alfa, Beta, Gamma Tittle: My Song
         
                   Actual filename: alfa, beta, gamma _ My Song

                                    I want to trim the filename field after the first ( , ) to obtain this:

               Expected filename: alfa _ My Song
```

---

<div class="post-metadata">

### Author: ![Tarc](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/9fc348/32.png) [@Tarc](https://community.mp3tag.de/u/Tarc)
#### Post date: [January 7, 2010, 2:22pm UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/2 "2010-01-07T14:22:37Z")

</div>

Hi,  
Double check if it works:

Make a new action: "Replace with regular expression"  
"Field": _FILENAME  
"Regular expression": ^(.?)(\s?),(.\*?)_(\s\*?)([^\s])(.\*)$  
"Replace with": $1 \_ $5$6

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [January 7, 2010, 2:51pm UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/3 "2010-01-07T14:51:24Z")

</div>

> [@Kimosavi](#):
>
> ... Actual filename: alfa, beta, gamma \_ My Song ... Expected filename: alfa \_ My Song

$left(%\_FILENAME%,$sub($strchr(%\_FILENAME%,','),1))$mid(%\_FILENAME%,$strchr(%_FILENAME%,'_'),$len(%\_FILENAME%))

DD.20100107.1651.CET

---

<div class="post-metadata">

### Author: ![kimosapiens](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/eb9ed0/32.png) [@kimosapiens](https://community.mp3tag.de/u/kimosapiens)
#### Post date: [January 7, 2010, 8:38pm UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/4 "2010-01-07T20:38:00Z")

</div>

> [@DetlevD](#):
>
> $left(%\_FILENAME%,$sub($strchr(%\_FILENAME%,','),1))$mid(%\_FILENAME%,$strchr(%_FILENAME%,'_'),$len(%\_FILENAME%))
> 
> DD.20100107.1651.CET

I put your command in FORMAT VALUE and work fine except in cases where the name of one of the artists includes last name:

```
                                 Example: alfa, beta, gamma gamma, zeta_Song Title

```

in these case, the filename is not trimed.

Thanks again !!!  
 ![:unsure:](https://community.mp3tag.de/uploads/default/original/1X/cfaeba84fe6704387c5b34dfdd8172bd51b6f533.gif ":unsure:")

---

<div class="post-metadata">

### Author: ![Tarc](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/9fc348/32.png) [@Tarc](https://community.mp3tag.de/u/Tarc)
#### Post date: [January 7, 2010, 8:39pm UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/5 "2010-01-07T20:39:22Z")

</div>

> [@Kimosavi](#):
>
> Thank's for your help. But, I need to know where to put this. ![:unsure:](https://community.mp3tag.de/uploads/default/original/1X/cfaeba84fe6704387c5b34dfdd8172bd51b6f533.gif ":unsure:") Is it a regular expression, guess value, or what ?
> 
> 1. Action Type:
> 
> 2. Field:
> 
> 3. Regular Expression:
> 
> 4. Replace Matches with:
> 
> or whatever the setting is.....
> 
> Thanks again !!!  
> ![:unsure:](https://community.mp3tag.de/uploads/default/original/1X/cfaeba84fe6704387c5b34dfdd8172bd51b6f533.gif ":unsure:")

Mine didn't work?

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [January 7, 2010, 9:06pm UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/6 "2010-01-07T21:06:10Z")

</div>

> [@Tarc](#):
>
> Mine didn't work?

He does not know where ... or why ...

DD.20100107.2305.CET

---

<div class="post-metadata">

### Author: ![Tarc](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/9fc348/32.png) [@Tarc](https://community.mp3tag.de/u/Tarc)
#### Post date: [January 7, 2010, 9:09pm UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/7 "2010-01-07T21:09:01Z")

</div>

> [@DetlevD](#):
>
> He does not know where ... or why ...
> 
> DD.20100107.2305.CET

OK it's just that while your (impressive-looking by the way) explanation did not say where he should put it, mine explained that, too, and as far as I know it is a working solution, so I was just wondering if he ever tried it.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [January 7, 2010, 9:13pm UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/8 "2010-01-07T21:13:01Z")

</div>

> [@Kimosavi](#):
>
> Thank's for your help. But, I need to know where to put this. ![:unsure:](https://community.mp3tag.de/uploads/default/original/1X/cfaeba84fe6704387c5b34dfdd8172bd51b6f533.gif ":unsure:") Is it a regular expression, guess value, or what ?

I guess it is a "Format value" on the field "\_FILENAME".

DD.20100107.2312.CET

---

<div class="post-metadata">

### Author: ![Tarc](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/9fc348/32.png) [@Tarc](https://community.mp3tag.de/u/Tarc)
#### Post date: [January 7, 2010, 9:17pm UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/9 "2010-01-07T21:17:12Z")

</div>

> [@DetlevD](#):
>
> I guess it is a "Format value" on the field "\_FILENAME".
> 
> DD.20100107.2312.CET

Are you a programmer?  
I noticed you are good at coding but not always know how exactly mp3tag applies RegExp:)  
Some of the stuff you write takes quite a while for me to see through (nice)

---

<div class="post-metadata">

### Author: ![kimosapiens](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/eb9ed0/32.png) [@kimosapiens](https://community.mp3tag.de/u/kimosapiens)
#### Post date: [January 7, 2010, 9:38pm UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/10 "2010-01-07T21:38:14Z")

</div>

> [@DetlevD](#):
>
> I guess it is a "Format value" on the field "\_FILENAME".
> 
> DD.20100107.2312.CET

I put your command in FORMAT VALUE and work fine except in cases where the name of one of the artists includes last name:

Example: alfa, beta, gamma gamma, zeta\_Song Title

in these case, the filename is not trimmed. Any solution ? ? ?

Thanks again !!!

---

<div class="post-metadata">

### Author: ![kimosapiens](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/eb9ed0/32.png) [@kimosapiens](https://community.mp3tag.de/u/kimosapiens)
#### Post date: [January 7, 2010, 9:53pm UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/11 "2010-01-07T21:53:57Z")

</div>

> [@Tarc](#):
>
> Hi,  
> Double check if it works:
> 
> Make a new action: "Replace with regular expression"  
> "Field": _FILENAME  
> "Regular expression": ^(.?)(\s?),(.\*?)_(\s\*?)([^\s])(.\*)$  
> "Replace with": $1 \_ $5$6

It's perfect !!! 😃 Thank's !!! ![:w00t:](https://community.mp3tag.de/uploads/default/original/1X/cb01eca72fe9339ff6f3ec9f1e3c5fe002be0f0a.gif ":w00t:") This forum rocks !

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [January 8, 2010, 8:45am UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/12 "2010-01-08T08:45:06Z")

</div>

> [@Kimosavi](#):
>
> ... I put your command in FORMAT VALUE and work fine except in cases where the name of one of the artists includes last name:  
> Example: alfa, beta, gamma gamma, zeta\_Song Title  
> in these case, the filename is not trimmed. Any solution ? ? ?  
> Thanks again !!!

I cannot see any problem, scripting expression works fine even with your new example:

$left(%\_FILENAME%,$sub($strchr(%\_FILENAME%,','),1))$mid(%\_FILENAME%,$strchr(%_FILENAME%,'_'),$len(%\_FILENAME%))

Preview gives:  
"O:\TEST\alfa, beta, gamma gamma, zeta\_Song Title.mp3" -\>  
"O:\TEST\alfa\_Song Title.mp3"

DD.20100108.1044.CET

---

<div class="post-metadata">

### Author: ![cforbush](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/f05b48/32.png) [@cforbush](https://community.mp3tag.de/u/cforbush)
#### Post date: [January 22, 2010, 9:59pm UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/13 "2010-01-22T21:59:29Z")

</div>

ok, I understand how to replace with regular expression. I just don't know what codes to use to do what I need to do.

I want to DELETE the artist name from the file name, and only leave the song title. my song looks like this

artist - title

I want it to look like this

title

I just do not know what codes to put in which places (I'm assuming it is a \_filename, but I'm not sure on the "regular expression: and the "replace matches with" function should show. Also, a lot of these songs may not have the artist name in the id tag (is that the right word, hopefully you understand what I mean), and it would be nice to put it in the tag. If you could show me THAT, I would be eternailly greatful! 😲

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [November 8, 2011, 12:06am UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/14 "2011-11-08T00:06:58Z")

</div>

> [@Kimosavi](#):
>
> ... How do I trim the filename to make it show only the first artist from a list of contributing artists ?  
> Example: ...  
> Actual filename: alfa, beta, gamma \_ My Song  
> I want to trim the filename field after the first ( , ) to obtain this:  
> Expected filename: alfa \_ My Song

 

**Convert** | **Filename - Filename** | **ALT+3**

 

_Select format string_

 

Old filename pattern:  
**%1, %2 \_ %3**

 

New filename pattern:  
**%1 \_ %3**

 

Preview  
**alfa \_ My Song.mp3**

 

... or ...  
Action: Format value  
Field: \_FILENAME  
Formatstring: **$regexp(%\_filename%,'^(.+?)(, .+?)+( \_ .+)$','$1$3')**  
From:  
alfa, beta, gamma \_ My Song  
To:  
alfa \_ My Song

... or ...  
Action: Format value  
Field: \_FILENAME  
Formatstring: **$regexp(%\_filename%,'^(.+?), .+ \_ (.+)$','$1 \_ $2')**  
From:  
alfa, beta, gamma \_ My Song  
To:  
alfa \_ My Song

DD.20111108.0220.CET

---

<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 9, 2026, 12:22pm UTC](https://community.mp3tag.de/t/trim-some-contributing-artist-from-filename/9660/15 "2026-02-09T12:22:04Z")

</div>


