# Extract track number from title and place it in track field

**URL:** <https://community.mp3tag.de/t/extract-track-number-from-title-and-place-it-in-track-field/49295>\
**Category:** Support\
**Created:** [June 13, 2020, 12:12pm UTC](https://community.mp3tag.de/t/extract-track-number-from-title-and-place-it-in-track-field/49295 "2020-06-13T12:12:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![legohund](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/76d3ee/32.png) [@legohund](https://community.mp3tag.de/u/legohund)\
**Post date:** [June 13, 2020, 12:12pm UTC](https://community.mp3tag.de/t/extract-track-number-from-title-and-place-it-in-track-field/49295/1 "2020-06-13T12:12:11Z")

</div>

I have several files that with file names that contain the track number in the file name, but have no track number listed in the track field. I want to extract and write the track field.

E..g  
current title  
Die laute Lili (2/5): Pepipuppe - Betthupferl - Gute-Nacht-Geschichten für Kinder - BR - 03.12.2019

Track number should be  
2

I came up with the following, but I'm only a regular expression beginner. So my solution seems rather clumsy to me and it only works for one digit track numbers

Action  
Copy the content of the title track field to the track field  
Format value "TRACK": %title%

Action  
Delete all non number characters from the track field  
Regular expression"TRACK": "[^\d]" -\> ""

Action  
Keep the first number of the track field and delete all other numbers  
Regular expression"TRACK": "^(\d)\d.\*" -\> "$1"

How can I improve this?

---

<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:** [June 13, 2020, 1:49pm UTC](https://community.mp3tag.de/t/extract-track-number-from-title-and-place-it-in-track-field/49295/2 "2020-06-13T13:49:20Z")

</div>

> [@legohund](#):
>
> Die laute Lili (2/5): Pepipuppe - Betthupferl - Gute-Nacht-Geschichten für Kinder - BR - 03.12.2019

You could use an action of the type "Guess value" (import tag fields)  
Source: %title%  
Target: `%dummy%(%track%/%dummy%`

of if you have to do it with a regular expression:  
Format value for TRACK  
Format string: `$regexp(%title%,.*(\d+)\/.*,$1)`

---

<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:28pm UTC](https://community.mp3tag.de/t/extract-track-number-from-title-and-place-it-in-track-field/49295/3 "2026-02-09T12:28:39Z")

</div>


