# Selective combo of content from multiple fields

**URL:** https://community.mp3tag.de/t/selective-combo-of-content-from-multiple-fields/66087
**Category:** Support
**Created:** [September 28, 2024, 4:51pm UTC](https://community.mp3tag.de/t/selective-combo-of-content-from-multiple-fields/66087 "2024-09-28T16:51:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mazeckenrode](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/e68b1a/32.png) [@mazeckenrode](https://community.mp3tag.de/u/mazeckenrode)
#### Post date: [September 28, 2024, 4:51pm UTC](https://community.mp3tag.de/t/selective-combo-of-content-from-multiple-fields/66087/1 "2024-09-28T16:51:22Z")

</div>

Greetings, all. Trying to use Format Values and regex scripting to modify an existing field using elements of content from another field, as follows:

`%field1%` = `Box Set 5: Early Tracks (1965) [2024]`

`%field2%` = `Box Set V: 1965–1985 [Ficticious Records FR-3791/8524601423791-01/8524601423791]`

Format Values / `%field2%`: `$regexp(%field2%,^(Box Set V:) 1965–1985 (\'['.+?\']')'$',\1 $regexp(%field1%,^Box Set 5: (.+? \(\d{4}(?:–\d{4})\)) \'['2024\']$',\1))`

Desired result: `%field2%` = `Box Set V: Early Tracks (1965) [Ficticious Records FR-3791/8524601423791-01/8524601423791]`

Actual result: `%field2%` = `Box Set V: Box Set 5: Early Tracks (1965) [2024]`

Is what I want to do possible, and if so, what am I doing wrong?

---

<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: [September 28, 2024, 5:33pm UTC](https://community.mp3tag.de/t/selective-combo-of-content-from-multiple-fields/66087/2 "2024-09-28T17:33:10Z")

</div>

I have tried this:  
`$regexp('Box Set V: 1965–1985 [Ficticious Records FR-3791/8524601423791-01/8524601423791]',^(.*\:) \d+–\d+ (.+?)'$',$1 $regexp('Box Set 5: Early Tracks (1965) [2024]','^.*: (.*?) (\(\d{4}\)) \[\d+\]$',$1 $2) $2)`  
You will recognize the contents of FIELD1 and FIELD2  
That expression leads to:  
`Box Set V: Early Tracks (1965) [Ficticious Records FR-3791/8524601423791-01/8524601423791]`

---

<div class="post-metadata">

### Author: ![mazeckenrode](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/e68b1a/32.png) [@mazeckenrode](https://community.mp3tag.de/u/mazeckenrode)
#### Post date: [September 28, 2024, 10:59pm UTC](https://community.mp3tag.de/t/selective-combo-of-content-from-multiple-fields/66087/3 "2024-09-28T22:59:03Z")

</div>

Ok, thanks. I was still beating my head against a wall trying to figure out why my method didn’t work, but think I got it now. My original code was:

`$regexp(%field2%,^(Box Set V:) 1965–1985 (\'['.+?\']')'$',\1 $regexp(%field1%,^Box Set 5: (.+? \(\d{4}(?:–\d{4})\)) \'['2024\']$',\1))`

…but I failed to account for that extra part `(?:–\d{4})`, which may or may not need to be matched — some of my use cases have year ranges such as `(1967–1968)` — so it needed to be `(?:–\d{4})?`. Now it works.

---

<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: [October 28, 2024, 10:59pm UTC](https://community.mp3tag.de/t/selective-combo-of-content-from-multiple-fields/66087/4 "2024-10-28T22:59:10Z")

</div>

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