# How to use $delprefix for multiple artists?

**URL:** <https://community.metabrainz.org/t/how-to-use-delprefix-for-multiple-artists/815718>\
**Category:** MusicBrainz Picard\
**Created:** [September 29, 2026, 2:31pm UTC](https://community.metabrainz.org/t/how-to-use-delprefix-for-multiple-artists/815718 "2026-09-29T14:31:02Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimbob100101](https://community.metabrainz.org/user_avatar/community.metabrainz.org/jimbob100101/32/64212_2.png) [@jimbob100101](https://community.metabrainz.org/u/jimbob100101)\
**Post date:** [September 29, 2026, 2:31pm UTC](https://community.metabrainz.org/t/how-to-use-delprefix-for-multiple-artists/815718/1 "2026-09-29T14:31:02Z")

</div>

Hello,

I currently use the following custom tagging script…

`$setmulti(artistssort,$delprefix(%artists%,The))`

This works fine for most occasions, but it clearly doesn’t loop through each artist - so a release by `The Six Parts Seven & The Black Keys` will be tagged as…

`Six Parts Seven; The Black Keys`

I am not hugely familiar with the scripting language but it looks like i maybe need to use `$foreach` in my script - i’m just not sure how to use this function in combination with the above script so that I end up removing ‘The’ prefix from _all_ artists to give the following result…

`Six Parts Seven; Black Keys`

Could anyone give me a gentle nudge?!  
Cheers!

---

<div class="post-metadata">

**Author:** ![simbun](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@simbun](https://community.metabrainz.org/u/simbun)\
**Post date:** [September 30, 2026, 7:53am UTC](https://community.metabrainz.org/t/how-to-use-delprefix-for-multiple-artists/815718/2 "2026-09-30T07:53:44Z")

</div>

This is how I’d do it:  
`$setmulti(artistssort,$map(%artistssort%,$delprefix(%_loop_value%,The)))`

Just in case you don’t know, there is a plural artistsort variable available (%\_artists\_sort%).

---

<div class="post-metadata">

**Author:** ![jimbob100101](https://community.metabrainz.org/user_avatar/community.metabrainz.org/jimbob100101/32/64212_2.png) [@jimbob100101](https://community.metabrainz.org/u/jimbob100101)\
**Post date:** [September 30, 2026, 9:38am UTC](https://community.metabrainz.org/t/how-to-use-delprefix-for-multiple-artists/815718/3 "2026-09-30T09:38:31Z")

</div>

Thanks very much, but sadly that doesn’t work as artistssort is a custom tag so there is nothing to map so it produces no tag at all.

I then tried changing the script to use the variable `_artists_sort` that you suggested as per below…

`$setmulti(artistssort,$map(%_artists_sort%,$delprefix(%_loop_value%,The)))`

But this tag has already moved the ‘The’ to the end so it’s no longer a prefix but a suffix!!

I might have to rethink my tagging structure!

Cheers ,

James

---

<div class="post-metadata">

**Author:** ![simbun](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@simbun](https://community.metabrainz.org/u/simbun)\
**Post date:** [September 30, 2026, 9:53am UTC](https://community.metabrainz.org/t/how-to-use-delprefix-for-multiple-artists/815718/4 "2026-09-30T09:53:38Z")

</div>

> [@jimbob100101](#):
>
> Thanks very much, but sadly that doesn’t work as artistssort is a custom tag so there is nothing to map so it produces no tag at all.

Sorry that was the code I used for testing (couldn’t find an album with multiple artists beginning with “The”), just use %artists%  
`$setmulti(artistssort,$map(%artists%,$delprefix(%_loop_value%,The)))`

EDIT: I know [LMS](https://github.com/epoupon/lms) supports `artistssort` but I don’t think many systems do.

---

<div class="post-metadata">

**Author:** ![jimbob100101](https://community.metabrainz.org/user_avatar/community.metabrainz.org/jimbob100101/32/64212_2.png) [@jimbob100101](https://community.metabrainz.org/u/jimbob100101)\
**Post date:** [September 30, 2026, 10:11am UTC](https://community.metabrainz.org/t/how-to-use-delprefix-for-multiple-artists/815718/5 "2026-09-30T10:11:25Z")

</div>

Yes tried that too but that actually strips the “The” from the `Artists` tag too, not just the `artistsort` tag

---

<div class="post-metadata">

**Author:** ![simbun](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@simbun](https://community.metabrainz.org/u/simbun)\
**Post date:** [September 30, 2026, 10:14am UTC](https://community.metabrainz.org/t/how-to-use-delprefix-for-multiple-artists/815718/6 "2026-09-30T10:14:14Z")

</div>

Does it! I’ll try it out, in the meantime:

```auto
$setmulti(artistssort,%artists%)
$setmulti(artistssort,$map(%artistssort%,$delprefix(%_loop_value%,The)))

```

EDIT: I’ve just tested the code and it doesn’t strip it from %artists%

```auto
$setmulti(artistssort,$map(%artists%,$delprefix(%_loop_value%,The)))

```

Hmmm. It does if I set it manually:

```auto
$setmulti(artists,The Band; The Beatles)
$setmulti(artistssort,$map(%artists%,$delprefix(%_loop_value%,The)))

```

---

<div class="post-metadata">

**Author:** ![jimbob100101](https://community.metabrainz.org/user_avatar/community.metabrainz.org/jimbob100101/32/64212_2.png) [@jimbob100101](https://community.metabrainz.org/u/jimbob100101)\
**Post date:** [September 30, 2026, 10:32am UTC](https://community.metabrainz.org/t/how-to-use-delprefix-for-multiple-artists/815718/7 "2026-09-30T10:32:39Z")

</div>

weirdly it does for me - ive turned off all other scripts and running that code tries to adjust both the `Artists` tag and the `artistssort` tag. maybe i need to walk away for a bit!

cheers for the help

---

<div class="post-metadata">

**Author:** ![simbun](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@simbun](https://community.metabrainz.org/u/simbun)\
**Post date:** [September 30, 2026, 10:44am UTC](https://community.metabrainz.org/t/how-to-use-delprefix-for-multiple-artists/815718/8 "2026-09-30T10:44:28Z")

</div>

It looks like the behaviour is slightly different on Picard v2 so probably best to use:

```auto
$setmulti(artistssort,%artists%)
$setmulti(artistssort,$map(%artistssort%,$delprefix(%_loop_value%,The)))

```

---

<div class="post-metadata">

**Author:** ![jimbob100101](https://community.metabrainz.org/user_avatar/community.metabrainz.org/jimbob100101/32/64212_2.png) [@jimbob100101](https://community.metabrainz.org/u/jimbob100101)\
**Post date:** [September 30, 2026, 10:57am UTC](https://community.metabrainz.org/t/how-to-use-delprefix-for-multiple-artists/815718/9 "2026-09-30T10:57:27Z")

</div>

> [@simbun](#):
>
> ```auto
> $setmulti(artistssort,%artists%)
> $setmulti(artistssort,$map(%artistssort%,$delprefix(%_loop_value%,The)))
> 
> ```

ooh wait this might be it!

sorry didn’t think to mention what version i was on - are you using picard version 3?

---

<div class="post-metadata">

**Author:** ![simbun](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@simbun](https://community.metabrainz.org/u/simbun)\
**Post date:** [September 30, 2026, 11:49am UTC](https://community.metabrainz.org/t/how-to-use-delprefix-for-multiple-artists/815718/10 "2026-09-30T11:49:29Z")

</div>

Yes I’ve moved to v3. I have a pretty simple workflow (only a couple of plug-ins) and it’s been working well for me.

---

<div class="post-metadata">

**Author:** ![jimbob100101](https://community.metabrainz.org/user_avatar/community.metabrainz.org/jimbob100101/32/64212_2.png) [@jimbob100101](https://community.metabrainz.org/u/jimbob100101)\
**Post date:** [September 30, 2026, 12:04pm UTC](https://community.metabrainz.org/t/how-to-use-delprefix-for-multiple-artists/815718/11 "2026-09-30T12:04:58Z")

</div>

I’ve not tried it yet, so i need to read up on the changes as think it’s due for release soon!

Cheers for your help - that last script is working great thanks
