Automatic format of returned track number

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?

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.

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