# Automatic format of returned track number

**URL:** https://community.mp3tag.de/t/automatic-format-of-returned-track-number/14130
**Category:** Support
**Created:** [November 15, 2012, 1:58pm UTC](https://community.mp3tag.de/t/automatic-format-of-returned-track-number/14130 "2012-11-15T13:58:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ronblock1](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/bc79bd/32.png) [@ronblock1](https://community.mp3tag.de/u/ronblock1)
#### Post date: [November 15, 2012, 1:58pm UTC](https://community.mp3tag.de/t/automatic-format-of-returned-track-number/14130/1 "2012-11-15T13:58:22Z")

</div>

When I access tag information from Amazon, MusicBrainz, etc. the format of the track number varies from 1, 2, 3 to 01, 02, 03 or 1/8, 2/8, 3/8. Is there a way to automatically convert the format to single digit (no leading zero) when it is retrieved?

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [November 15, 2012, 4:18pm UTC](https://community.mp3tag.de/t/automatic-format-of-returned-track-number/14130/2 "2012-11-15T16:18:40Z")

</div>

There's several different ways to do it but use.

Action: FORMAT  
Field: TRACK  
Value: $regexp(%track%,'^0\*(.+)','$1')

This will get remove any 0's at the start if they exist.

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [November 15, 2012, 5:09pm UTC](https://community.mp3tag.de/t/automatic-format-of-returned-track-number/14130/3 "2012-11-15T17:09:30Z")

</div>

Depends on exactly what you want to do. The simple regex in the previous post will only remove leading zeros from the first number encountered, so it would change:

01 =\> 1  
1/8 =\> 1/8  
01/08 =\> 1/08  
1 of 8 =\> 1 of 8  
01 of 08 =\> 1 of 08

Or you can use the following to remove everything but the first number, and at the same time remove leading zeros from the number:

_Action type:_ **Format value**  
_Field:_ **TRACK**  
_Format string:_ **$fmtNum(%track%)**

01 =\> 1  
1/8 =\> 1  
01/08 =\> 1  
1 of 8 =\> 1  
01 of 08 =\> 1

Or you might want to leave the tracktotal part and remove leading zeros from all numbers:

_Action type:_ **Format value**  
_Field:_ **TRACK**  
_Format string:_ **$regexp(%track%,'\b0+(\d+)',$1)**

01 =\> 1  
1/8 =\> 1/8  
01/08 =\> 1/8  
1 of 8 =\> 1 of 8  
01 of 08 =\> 1 of 8

---

<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:24pm UTC](https://community.mp3tag.de/t/automatic-format-of-returned-track-number/14130/4 "2026-02-09T12:24:10Z")

</div>


