# Insert tag fields inside another tag field

**URL:** https://community.mp3tag.de/t/insert-tag-fields-inside-another-tag-field/45991
**Category:** General Discussion
**Created:** [July 25, 2019, 8:13pm UTC](https://community.mp3tag.de/t/insert-tag-fields-inside-another-tag-field/45991 "2019-07-25T20:13:35Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![JoseyMcWales](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@JoseyMcWales](https://community.mp3tag.de/u/JoseyMcWales)
#### Post date: [July 25, 2019, 8:13pm UTC](https://community.mp3tag.de/t/insert-tag-fields-inside-another-tag-field/45991/1 "2019-07-25T20:13:35Z")

</div>

Hi Guys

Just joined and are very new to this scripting thing.

All my tracks have the fields %album%, %year%, %release date%.

%year% is the year when an artist released a certain album for the very first time

%release date% is the year when a particular release of that album was released (and may differ from %year% or not.

Actually all %album% fileds are tagged like this:

year - album\_name [releasedate] (label, code, country)

example:  
1970 - Deep Purple In Rock [2009] (Audio Fidelity, AFZ 051, US)

I want to change album fileds in the following way:

album\_name [year - releasedate] (label, code, country)

example:  
Deep Purple In Rock [1970 - 2009] (Audio Fidelity, AFZ 051, US)

If possible best would be comparing year to release date and insert just one date when they are equal:

example:  
2013 - Now What [2013] (VIZP-116, SHM-CD, Japan)  
should become  
Now What [2013] (VIZP-116, SHM-CD, Japan)

Thank you in advance to anyone who will try to help !

---

<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 26, 2019, 6:43am UTC](https://community.mp3tag.de/t/insert-tag-fields-inside-another-tag-field/45991/2 "2019-07-26T06:43:24Z")

</div>

What have you tried so far?

---

<div class="post-metadata">

### Author: ![JoseyMcWales](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@JoseyMcWales](https://community.mp3tag.de/u/JoseyMcWales)
#### Post date: [July 26, 2019, 7:41am UTC](https://community.mp3tag.de/t/insert-tag-fields-inside-another-tag-field/45991/3 "2019-07-26T07:41:08Z")

</div>

I found this solution:

[Fill Year-ReleaseYear.mta](https://community.mp3tag.de/uploads/short-url/loZVrU49m6WkFTvYx9nnPklH40G.mta) (293 Bytes)

---

<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 26, 2019, 3:46pm UTC](https://community.mp3tag.de/t/insert-tag-fields-inside-another-tag-field/45991/4 "2019-07-26T15:46:17Z")

</div>

I think you could modify action #2 to  
Repace string:`2='$1$2'%year-relase%'$4$5'`  
so that you do not need action #3

---

<div class="post-metadata">

### Author: ![JoseyMcWales](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@JoseyMcWales](https://community.mp3tag.de/u/JoseyMcWales)
#### Post date: [July 26, 2019, 4:45pm UTC](https://community.mp3tag.de/t/insert-tag-fields-inside-another-tag-field/45991/5 "2019-07-26T16:45:39Z")

</div>

I had tried to do that but for some reason it doesn't work. Maybe I don't write the syntax correctly ?

The content of field %year-releaseyear" is not read inside "replace with regular expression" action while it's read in replace action !

---

<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 26, 2019, 5:02pm UTC](https://community.mp3tag.de/t/insert-tag-fields-inside-another-tag-field/45991/6 "2019-07-26T17:02:42Z")

</div>

please note the various apostrophes that are surround %year-release%.  
You can test the regular expression with $regexp() in the function Convert\>Tag-Tag  
e.g.  
`$regexp(%title%,(.*)(\[)(.+?)(\])(.*),`'$1$2'%year-relase%'$4$5'`)`

---

<div class="post-metadata">

### Author: ![JoseyMcWales](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@JoseyMcWales](https://community.mp3tag.de/u/JoseyMcWales)
#### Post date: [July 27, 2019, 7:15am UTC](https://community.mp3tag.de/t/insert-tag-fields-inside-another-tag-field/45991/7 "2019-07-27T07:15:46Z")

</div>

For some reasons $regexp only works if I write it this way (tested in Convert\>Tag-Tag):

$regexp(%album%,'(._)([)(.+?)(])(._)', $1$2 %year-releaseyear%$4$5)

and I have to put a space between $2 and %year-releaseyear% but I end up having a space between "[" and the year that I don't want
