# Exporting List of Unique Genres w/o Final Comma

**URL:** https://community.mp3tag.de/t/exporting-list-of-unique-genres-w-o-final-comma/65408
**Category:** Support
**Created:** [July 28, 2024, 10:58am UTC](https://community.mp3tag.de/t/exporting-list-of-unique-genres-w-o-final-comma/65408 "2024-07-28T10:58:22Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![abijahmaniaco](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/5fc32e/32.png) [@abijahmaniaco](https://community.mp3tag.de/u/abijahmaniaco)
#### Post date: [July 28, 2024, 10:58am UTC](https://community.mp3tag.de/t/exporting-list-of-unique-genres-w-o-final-comma/65408/1 "2024-07-28T10:58:22Z")

</div>

My current script is:

`$filename(F:\Parallel Music Miscellanea\Templates\test.txt,utf-8)$regexp($loop(%genre%,1)%genre%, $loopend(),', $',)`

For a selection of 20 songs I’m working with, the result is:

Euro House, Hands Up, Hard House, Hard Trance, Progressive House, Progressive Trance, Trance,

The issue is the final “, ” that it won’t remove for some reason. What am I doing wrong here?

Thanks.

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [July 28, 2024, 11:16am UTC](https://community.mp3tag.de/t/exporting-list-of-unique-genres-w-o-final-comma/65408/2 "2024-07-28T11:16:03Z")

</div>

You could try it with:

```auto
$filename(F:\Parallel Music Miscellanea\Templates\test.txt,utf-8)$regexp($loop(%genre%,1)%genre% 
$loopend(),', $',)

```

I have not tried to further adjust the logic in your code.

---

<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: [July 28, 2024, 11:48am UTC](https://community.mp3tag.de/t/exporting-list-of-unique-genres-w-o-final-comma/65408/3 "2024-07-28T11:48:11Z")

</div>

Try

```auto
$filename(F:\Parallel Music Miscellanea\Templates\test.txt,utf-8)$loop(%genre%,1)$puts(g,$get(g)%genre%', ')$loopend()$regexp($get(g),', $',)

```

---

<div class="post-metadata">

### Author: ![abijahmaniaco](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/5fc32e/32.png) [@abijahmaniaco](https://community.mp3tag.de/u/abijahmaniaco)
#### Post date: [July 28, 2024, 12:18pm UTC](https://community.mp3tag.de/t/exporting-list-of-unique-genres-w-o-final-comma/65408/4 "2024-07-28T12:18:22Z")

</div>

That worked. Remarkable!

I tweaked it slightly to utilize multiple genre tags per track:

`$filename(F:\Parallel Music Miscellanea\Templates\test.txt,utf-8)$loop(%genre%,1)$puts(g,$get(g)$meta(genre)', ')$loopend()$regexp($get(g),', $',)`

---

<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: [August 27, 2024, 12:18pm UTC](https://community.mp3tag.de/t/exporting-list-of-unique-genres-w-o-final-comma/65408/5 "2024-08-27T12:18:39Z")

</div>

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