# Add Track Number to Title Field

**URL:** https://community.mp3tag.de/t/add-track-number-to-title-field/9563
**Category:** Support
**Created:** [December 21, 2009, 3:52am UTC](https://community.mp3tag.de/t/add-track-number-to-title-field/9563 "2009-12-21T03:52:51Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ebasta](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/f1d935/32.png) [@ebasta](https://community.mp3tag.de/u/ebasta)
#### Post date: [December 21, 2009, 3:52am UTC](https://community.mp3tag.de/t/add-track-number-to-title-field/9563/1 "2009-12-21T03:52:51Z")

</div>

Hello. I am trying to add the track number and some characters before and after the track number added to the Title field string:

> From: 003 Aria Hier ist das . . .
> 
> To this (the "01" is the track number):  
> 003-01 Aria Hier ist das . . .

  
Then I need to add characters to this:

> From: 003-01 Aria Hier ist das . . .
> 
> To:  
> Bach: 003 [Ril] 01 Aria {Hier ist das...}

  
Is there any way to do this with a regular expression or several?

E

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [December 21, 2009, 6:31am UTC](https://community.mp3tag.de/t/add-track-number-to-title-field/9563/2 "2009-12-21T06:31:19Z")

</div>

> [@ebasta](#):
>
> Hello. I am trying to add the track number and some characters before and after the track number added to the Title field string:  
> From:  
> 003 Aria Hier ist das . . .  
> To this (the "01" is the track number):  
> 003-01 Aria Hier ist das . . .

$replace($regexp(%TITLE%,'^(\d+) (.+)$','$1-{{1}} $2'),'{{1}}',%TRACK%)  
From:  
003 Aria Hier ist das  
To:  
003-01 Aria Hier ist das

> [@ebasta](#):
>
> ... Then I need to add characters to this:  
> From:  
> 003-01 Aria Hier ist das . . .  
> To:  
> Bach: 003 [Ril] 01 Aria {Hier ist das...}

Where do all the values come from?  
ARTIST: Bach  
???: 003  
???: Ril  
TRACK: 01  
???: Aria  
???: Hier ist das...  
Are these values stored already in tag fields?  
If so you can compose your TITLE string from the values out of the other tag fields.  
Otherwise it would be a bit more difficult to create your format.

The string "Bach: " has to be prepended. Easy.  
The string " [Ril] " has to be inserted by replacing "-" within the numbers "003-01". Easy.  
Because the word "Aria" has to be encountered as an one word exception there is an unknown series of words from the tail which have to be enclosed with curly brackets. Problematic.

DD.20091221.0849.CET

---

<div class="post-metadata">

### Author: ![ebasta](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/f1d935/32.png) [@ebasta](https://community.mp3tag.de/u/ebasta)
#### Post date: [December 21, 2009, 7:11am UTC](https://community.mp3tag.de/t/add-track-number-to-title-field/9563/3 "2009-12-21T07:11:10Z")

</div>

Thank you for your quick reply.

All of the information is in the title field (the same as filename), so some ideal end format examples would be:

Bach: 048 [Ril] 01 Coro {Ich elender Mensch, wer wird mich erlosen}  
Bach: 048 [Ril] 02 Recitativo (A) {O Schmerz, o Elend, so mich trifft}  
Bach: 048 [Ril] 03 Choral {Solls ja so sein, dass Straf und Pein}  
Bach: 048 [Ril] 04 Aria (A) {Ach lege das Sodom der sundlichen Glieder}

But there are about 80 discs that I ripped and CDDB fills in the titles in various ways, such as:

22 BWV 187; Aria (S)\_ Gott versorget alles Leben  
01 Tˆnet, ihr Pauken! Erschallet, Trompeten! BWV 214 No. 1 Coro - Tˆnet, ihr Pau...  
15 Bach\_ 212 [Ril] 3 Recitativo (S\_B)\_ Nu, Mieke, gib dein Guschel immer her

Its a complete mess. So I wrote some replace and add and subtract actions to get it to a more manageable file name/title format. But I realize that automation will be out of the question.

---

<div class="post-metadata">

### Author: ![ebasta](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/f1d935/32.png) [@ebasta](https://community.mp3tag.de/u/ebasta)
#### Post date: [December 21, 2009, 7:28am UTC](https://community.mp3tag.de/t/add-track-number-to-title-field/9563/4 "2009-12-21T07:28:51Z")

</div>

How would I change the title field back - getting rid of the track name:

From:  
003-01 Aria Hier ist das  
To:  
003 Aria Hier ist das

(I am really trying to learn regular expression)

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [December 21, 2009, 9:52am UTC](https://community.mp3tag.de/t/add-track-number-to-title-field/9563/5 "2009-12-21T09:52:59Z")

</div>

> [@ebasta](#):
>
> How would I change the title field back - getting rid of the track name: ...

$regexp(%TITLE%,'^(\d+)(?:-\d+)( .+)$','$1$2')  
From:  
003-01 Aria Hier ist das  
To:  
003 Aria Hier ist das

DD.20091221.1152.CET

---

<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:22pm UTC](https://community.mp3tag.de/t/add-track-number-to-title-field/9563/6 "2026-02-09T12:22:02Z")

</div>


