# Copy year from filename/title to %year% field

**URL:** <https://community.mp3tag.de/t/copy-year-from-filename-title-to-year-field/55509>\
**Category:** Support\
**Created:** [December 13, 2021, 8:29pm UTC](https://community.mp3tag.de/t/copy-year-from-filename-title-to-year-field/55509 "2021-12-13T20:29:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KaeptnNuss](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kaeptnnuss/32/10498_2.png) [@KaeptnNuss](https://community.mp3tag.de/u/KaeptnNuss)\
**Post date:** [December 13, 2021, 8:29pm UTC](https://community.mp3tag.de/t/copy-year-from-filename-title-to-year-field/55509/1 "2021-12-13T20:29:30Z")

</div>

How do set up an action that searches for the occurrence of a four digit year (19xx) occurring anywhere within the string of either the filename or title and then copy it into the %year% field?

---

<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:** [December 13, 2021, 8:34pm UTC](https://community.mp3tag.de/t/copy-year-from-filename-title-to-year-field/55509/2 "2021-12-13T20:34:07Z")

</div>

try an action of the type "Format value" for %year%  
Format string: `$regexp(%_filename%%title%,.*(\d\d\d\d).*,$1)`  
If that does not work, you have to be more specific

---

<div class="post-metadata">

**Author:** ![KaeptnNuss](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kaeptnnuss/32/10498_2.png) [@KaeptnNuss](https://community.mp3tag.de/u/KaeptnNuss)\
**Post date:** [December 13, 2021, 8:49pm UTC](https://community.mp3tag.de/t/copy-year-from-filename-title-to-year-field/55509/3 "2021-12-13T20:49:37Z")

</div>

Wow, that worked! Thanks!!!

---

<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:** [January 12, 2022, 8:49pm UTC](https://community.mp3tag.de/t/copy-year-from-filename-title-to-year-field/55509/4 "2022-01-12T20:49:53Z")

</div>

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