# How to format a value following a directive?

**URL:** <https://community.mp3tag.de/t/how-to-format-a-value-following-a-directive/16301>\
**Category:** Support\
**Created:** [November 7, 2014, 11:22pm UTC](https://community.mp3tag.de/t/how-to-format-a-value-following-a-directive/16301 "2014-11-07T23:22:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sylvain.dmde](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/c57346/32.png) [@sylvain.dmde](https://community.mp3tag.de/u/sylvain.dmde)\
**Post date:** [November 7, 2014, 11:22pm UTC](https://community.mp3tag.de/t/how-to-format-a-value-following-a-directive/16301/1 "2014-11-07T23:22:14Z")

</div>

Hello, I would like to format the value following a following directive: I would like to keep(guard) my TITLE of my songs while adding at the very beginning of my titles(securities) the field ALBUMARTIST with a space and a hyphen(link) at the end more the original TITLE but than when the ALBUM is a COMPILATION. What would give with for ARTIST: SUDUAYA and for TITLE: Gathering under The Sun that is:  
Front: Gathering under the sun  
After formatting(layout) of the value that if the album is a compilation defined as 1 in Mp3Tag: SUDUAYA - Gathering under the sun

---

<div class="post-metadata">

**Author:** ![vkostas](https://community.mp3tag.de/user_avatar/community.mp3tag.de/vkostas/32/227_2.png) [@vkostas](https://community.mp3tag.de/u/vkostas)\
**Post date:** [November 8, 2014, 3:11am UTC](https://community.mp3tag.de/t/how-to-format-a-value-following-a-directive/16301/2 "2014-11-08T03:11:48Z")

</div>

Action: Format value  
Field: Title  
Format string $if($neql(%compilation%,1),%title%,%albumartist% - $regexp(%title%,'^._? - (._)$',$1))This will join AlbumArtist - Title only if title contains NOT string ' - '. You can run the action as many time as you like. It won't add multiple times the albumartist at the beginning of title. Please note that this will join the albumartist into an empty title and it does update album artist when it changes.  
E.g.

1. before action.  
Albumartist: **q** ueen  
Title: Innuendo
2. After action - one or many times  
Albumartist: **q** ueen  
Title: **q** ueen - Innuendo
3. Album artist changes (fix word case)  
Albumartist: **Q** ueen  
Title: **q** ueen - Innuendo
4. After action - one or many times  
Albumartist: **Q** ueen  
Title: **Q** ueen - Innuendo

---

<div class="post-metadata">

**Author:** ![sylvain.dmde](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/c57346/32.png) [@sylvain.dmde](https://community.mp3tag.de/u/sylvain.dmde)\
**Post date:** [November 8, 2014, 10:17am UTC](https://community.mp3tag.de/t/how-to-format-a-value-following-a-directive/16301/3 "2014-11-08T10:17:48Z")

</div>

Thank you for your answer, it is exactly that I to look. But for it is valid only if the title does not contain '-' I May if it is not too much to ask to have a line of code that could allow himself to him(it) with a title the expression of which contains '-' In you thank.

---

<div class="post-metadata">

**Author:** ![vkostas](https://community.mp3tag.de/user_avatar/community.mp3tag.de/vkostas/32/227_2.png) [@vkostas](https://community.mp3tag.de/u/vkostas)\
**Post date:** [November 8, 2014, 10:43am UTC](https://community.mp3tag.de/t/how-to-format-a-value-following-a-directive/16301/4 "2014-11-08T10:43:20Z")

</div>

OK. You can use the below but you may execute it **only once** or album artisth would be added multiple times.  
$if($neql(%compilation%,1),%title%,%albumartist% - %title%)Nevertheless the previous code does not add albumartist only title has (space)-(space), not only '-'.

---

<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:25pm UTC](https://community.mp3tag.de/t/how-to-format-a-value-following-a-directive/16301/5 "2026-02-09T12:25:21Z")

</div>

Closed on February 9, 2026, 12:25pm UTC


