# Smart append to a field

**URL:** https://community.mp3tag.de/t/smart-append-to-a-field/5073
**Category:** Support
**Created:** [June 26, 2007, 6:06pm UTC](https://community.mp3tag.de/t/smart-append-to-a-field/5073 "2007-06-26T18:06:29Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![ffolke](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/8edcca/32.png) [@ffolke](https://community.mp3tag.de/u/ffolke)
#### Post date: [June 26, 2007, 6:06pm UTC](https://community.mp3tag.de/t/smart-append-to-a-field/5073/1 "2007-06-26T18:06:29Z")

</div>

I know that you can do Format Value (%comment% + extra word) to add things, but it can't detect if the word is already there.

For instance, say I want to add "live" to a comment that already has "random words" in it, and NOT add it if the comment already contains "live".

AFAIK, this is not possible with FormatValue. I guess it takes a Regular Expression to tackle. Can anyone suggest how to do this? And what action would I use (Replace?)

Thanks smart regex'ers

---

<div class="post-metadata">

### Author: ![Sebastian\_Mares](https://community.mp3tag.de/user_avatar/community.mp3tag.de/sebastian_mares/32/9285_2.png) [@Sebastian\_Mares](https://community.mp3tag.de/u/Sebastian_Mares)
#### Post date: [June 26, 2007, 6:11pm UTC](https://community.mp3tag.de/t/smart-append-to-a-field/5073/2 "2007-06-26T18:11:34Z")

</div>

Should "live" be the last word? You could use something like this as formatstring:

$ifgreater($strstr($right(%comment%,4),Live),0,%comment%,%comment% Live)

---

<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: [June 26, 2007, 6:47pm UTC](https://community.mp3tag.de/t/smart-append-to-a-field/5073/3 "2007-06-26T18:47:04Z")

</div>

@ffolke: If the word "live" could be "anywhere" in your comment, it would be nearly impossible. Of course, one could build a regex to find "live" - but are you sure, that this "live" has no other meaning?

Whats about "live out there in the fog" or "live 8" or "live animal" - this could be tricky! 🕶

---

<div class="post-metadata">

### Author: ![ffolke](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/8edcca/32.png) [@ffolke](https://community.mp3tag.de/u/ffolke)
#### Post date: [June 26, 2007, 7:01pm UTC](https://community.mp3tag.de/t/smart-append-to-a-field/5073/4 "2007-06-26T19:01:39Z")

</div>

> [@Sebastian Mares](#):
>
> Should "live" be the last word? You could use something like this as formatstring:
> 
> $ifgreater($strstr($right(%comment%,4),Live),0,%comment%,%comment% Live)

It doesn't matter that it has to be the last word, just that it goes there without duplicating.

I just tried your suggestion, but it seems to add "Live" even if "Live" is present in the field somewhere (in other words it adds the word to every file).

---

<div class="post-metadata">

### Author: ![ffolke](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/8edcca/32.png) [@ffolke](https://community.mp3tag.de/u/ffolke)
#### Post date: [June 27, 2007, 4:39am UTC](https://community.mp3tag.de/t/smart-append-to-a-field/5073/5 "2007-06-27T04:39:56Z")

</div>

> [@LyricsLover](#):
>
> @ffolke: If the word "live" could be "anywhere" in your comment, it would be nearly impossible. Of course, one could build a regex to find "live" - but are you sure, that this "live" has no other meaning?
> 
> Whats about "live out there in the fog" or "live 8" or "live animal" - this could be tricky! 🕶

You are correct that "live" could be anywhere within the comment, but it can't be nearly impossible? As of right now, I know for a fact there would be no instances of "live" that are in the wrong context like your example. I would, however, like to employ this technique for styles or subgenres (that I put in comments) using the AMG script. I want to mass adjust several files for keywords that I think might be missing from AMG [ws]. What I don't want to do is create extra duplicate data that contains my desired keyword.

Unfortunately, I am very poor at RE's. And I couldn't get Sebastian's FormatValue to work. I tested with several files with different orders and configurations:

Live  
This is Live  
Live in Concert  
bootleg  
Live Live  
good and evil

Yet for some reason, Live was added to ALL files?!

Can someone give me some guidance? (or maybe a tutorial)

---

<div class="post-metadata">

### Author: ![Sebastian\_Mares](https://community.mp3tag.de/user_avatar/community.mp3tag.de/sebastian_mares/32/9285_2.png) [@Sebastian\_Mares](https://community.mp3tag.de/u/Sebastian_Mares)
#### Post date: [June 27, 2007, 12:15pm UTC](https://community.mp3tag.de/t/smart-append-to-a-field/5073/6 "2007-06-27T12:15:55Z")

</div>

Then you did something wrong. My formatstring should work as intended (and it does since I just tested) for the following:

Live  
This is Live  
Live Live

For the others it won't work since "Live" is not the last word obviously. By the way, we are talking about Format value not Regexp replace.

---

<div class="post-metadata">

### Author: ![ffolke](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/8edcca/32.png) [@ffolke](https://community.mp3tag.de/u/ffolke)
#### Post date: [June 27, 2007, 2:38pm UTC](https://community.mp3tag.de/t/smart-append-to-a-field/5073/7 "2007-06-27T14:38:20Z")

</div>

ok, I see, you're right. This only works if Live is at the end of the field source. I thought you meant the output would be appended to the end.

Is there any way to detect "live" anywhere in the field, so that it would add it if it was not present at all?

For instance if there was:

```
bootleg, live, guitar,
live, metal, alternative,
dance, pop/rock, live,
soft rock, singer/songwriter,

```

[each line representing a different file/same field]

The output would be that only the last one would get appended:

```
bootleg, live, guitar,
live, metal, alternative,
dance, pop/rock, live,
soft rock, singer/songwriter, live,

```

Additionally, would it be possible to include a comma with the output? Sorry to ask so much.

---

<div class="post-metadata">

### Author: ![Sebastian\_Mares](https://community.mp3tag.de/user_avatar/community.mp3tag.de/sebastian_mares/32/9285_2.png) [@Sebastian\_Mares](https://community.mp3tag.de/u/Sebastian_Mares)
#### Post date: [June 27, 2007, 2:50pm UTC](https://community.mp3tag.de/t/smart-append-to-a-field/5073/8 "2007-06-27T14:50:00Z")

</div>

$ifgreater($strstr(%comment%,live),0,%comment%,%comment%',' live)

or (if you want the comma appended)

$ifgreater($strstr(%comment%,live),0,%comment%,%comment% live',')

Please notice however that Mp3tag seems to differentiate between lowercase and uppercase and unfortunately, I don't know how to turn that off. Also, notice that my formatstring will find "live" even if it's part of a word like "alive" or "blahliveblah".

Edit: Sorry for writing this in German first - I am pretty tired at the moment. 😛

---

<div class="post-metadata">

### Author: ![ffolke](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/8edcca/32.png) [@ffolke](https://community.mp3tag.de/u/ffolke)
#### Post date: [June 27, 2007, 3:11pm UTC](https://community.mp3tag.de/t/smart-append-to-a-field/5073/9 "2007-06-27T15:11:35Z")

</div>

Danke, Takk, Gracias, Merci, Thanks. That will suffice.

I can always run the string twice with different case. And being part of a word should not pose too much of a problem.

---

<div class="post-metadata">

### Author: ![Sebastian\_Mares](https://community.mp3tag.de/user_avatar/community.mp3tag.de/sebastian_mares/32/9285_2.png) [@Sebastian\_Mares](https://community.mp3tag.de/u/Sebastian_Mares)
#### Post date: [June 27, 2007, 7:21pm UTC](https://community.mp3tag.de/t/smart-append-to-a-field/5073/10 "2007-06-27T19:21:52Z")

</div>

Actually, you can use this so that it works with "live", "LIVE", "LiVe", etc.:

$ifgreater($strstr($lower(%comment%),live),0,%comment%,%comment%',' live)

The very last "live" is the one that will be appended, so if you want to have it with an uppercase first letter, use

$ifgreater($strstr($lower(%comment%),live),0,%comment%,%comment%',' Live)

And sorry for writing in German. ![:blush:](https://community.mp3tag.de/uploads/default/original/1X/c5a064300f7d900a70c2196f6eee95e32dde9b52.gif ":blush:")

---

<div class="post-metadata">

### Author: ![ffolke](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/8edcca/32.png) [@ffolke](https://community.mp3tag.de/u/ffolke)
#### Post date: [June 28, 2007, 4:12am UTC](https://community.mp3tag.de/t/smart-append-to-a-field/5073/11 "2007-06-28T04:12:14Z")

</div>

Thanks a million. And German is no problem (as long as I have Google Translate).

---

<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:20pm UTC](https://community.mp3tag.de/t/smart-append-to-a-field/5073/12 "2026-02-09T12:20:22Z")

</div>


