# Extracting info from one field to another

**URL:** https://community.mp3tag.de/t/extracting-info-from-one-field-to-another/63593
**Category:** Support
**Created:** [January 28, 2024, 4:04pm UTC](https://community.mp3tag.de/t/extracting-info-from-one-field-to-another/63593 "2024-01-28T16:04:28Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![mrtrev](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/919ad9/32.png) [@mrtrev](https://community.mp3tag.de/u/mrtrev)
#### Post date: [January 28, 2024, 4:04pm UTC](https://community.mp3tag.de/t/extracting-info-from-one-field-to-another/63593/1 "2024-01-28T16:04:28Z")

</div>

Hi everyone,  
I'm trying to extract the first four digits from the comment field and copying them into the year field.  
Here's an example of the data in the comment field:

PlayoutONE Meta Data,1985,1,0,0,0,0,0

I've tried to create an action:

Format Value  
Field: YEAR  
Format String: $regexp(%COMMENT%,(\d{4}))

But nothing is happening, I've tried multiple variations.

Source: $regexp(%comment%,(\d{4})  
Target string: %comment%==%year%

I'm beginning to feel like I'm banging my head against a wall. I know I'm in the right area, however I think I'm missing the obvious point. Any help would be greatly appreciated.

Regards,

Trev

---

<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: [January 28, 2024, 4:07pm UTC](https://community.mp3tag.de/t/extracting-info-from-one-field-to-another/63593/2 "2024-01-28T16:07:44Z")

</div>

Try an action of the type "Format value" or Convert\>Tag-Tag for YEAR  
Format string: `$regexp(%comment%,.*(\d\d\d\d).*,$1)`

---

<div class="post-metadata">

### Author: ![mrtrev](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/919ad9/32.png) [@mrtrev](https://community.mp3tag.de/u/mrtrev)
#### Post date: [January 28, 2024, 5:02pm UTC](https://community.mp3tag.de/t/extracting-info-from-one-field-to-another/63593/3 "2024-01-28T17:02:34Z")

</div>

Hi ohrenkino,

It sort of worked, although it only inputs 2024 into the year field. Thanks for the suggestion!

---

<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: [January 28, 2024, 5:39pm UTC](https://community.mp3tag.de/t/extracting-info-from-one-field-to-another/63593/4 "2024-01-28T17:39:57Z")

</div>

> [@mrtrev](#):
>
> inputs 2024 into the year field.

If comment contiains 1985 as in your sample string, then I doubt that the expression will return 2024.  
What does the data really look like and which expression did you use to get 2024 and what did you expect to happen?  
 ![grafik](https://community.mp3tag.de/uploads/default/original/3X/7/2/72e7d28c34fe5b9ac97670a26f534587ec2cb105.png)

---

<div class="post-metadata">

### Author: ![mrtrev](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/919ad9/32.png) [@mrtrev](https://community.mp3tag.de/u/mrtrev)
#### Post date: [January 28, 2024, 7:17pm UTC](https://community.mp3tag.de/t/extracting-info-from-one-field-to-another/63593/5 "2024-01-28T19:17:08Z")

</div>

![2024_Sshot](https://community.mp3tag.de/uploads/default/original/3X/8/9/8995b60a929362903a603775f427f261893d5180.jpeg)

---

<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: [January 28, 2024, 7:26pm UTC](https://community.mp3tag.de/t/extracting-info-from-one-field-to-another/63593/6 "2024-01-28T19:26:01Z")

</div>

What does the extended tags dialogue Alt-T show for that exact file?  
I suspect the following:  
There are other tag versions in the file like APE  
and/or  
there is more than 1 comment field in the file.

---

<div class="post-metadata">

### Author: ![mrtrev](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/919ad9/32.png) [@mrtrev](https://community.mp3tag.de/u/mrtrev)
#### Post date: [January 28, 2024, 7:39pm UTC](https://community.mp3tag.de/t/extracting-info-from-one-field-to-another/63593/8 "2024-01-28T19:39:29Z")

</div>

![2024_Sshot](https://community.mp3tag.de/uploads/default/original/3X/f/0/f0f4390a76e89f693d78cff4c9733565d90f26b9.jpeg)

---

<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: [January 28, 2024, 7:42pm UTC](https://community.mp3tag.de/t/extracting-info-from-one-field-to-another/63593/9 "2024-01-28T19:42:04Z")

</div>

I see a "2024" further down the comment - and as the real string is much longer and features the pattern of 4 digits in a row several times, it is logical that the applied expression produces unexpected results.

Try  
Format string: `$regexp(%comment%,.*?(\d\d\d\d).*,$1)`

---

<div class="post-metadata">

### Author: ![mrtrev](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/919ad9/32.png) [@mrtrev](https://community.mp3tag.de/u/mrtrev)
#### Post date: [January 28, 2024, 7:54pm UTC](https://community.mp3tag.de/t/extracting-info-from-one-field-to-another/63593/10 "2024-01-28T19:54:08Z")

</div>

That's got it! Thank you, I've been trying to figure this out all afternoon.

---

<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 27, 2024, 7:54pm UTC](https://community.mp3tag.de/t/extracting-info-from-one-field-to-another/63593/11 "2024-02-27T19:54:53Z")

</div>

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