How to tag based on filename but limit the number of characters used for a field?

I'm wondering if someone can help with a basic problem I'm having. The filenames of my mp3s are something like "01Like a Rolling Stone". Normally, I would use Filename -> Tag and set it using %track%%title%, but the problem I have is that when I use this, MP3Tag tries to set the track equal to "01Like" (I think because there's no space between them). Is there a way to tell MP3Tag to use only the first two characters for the track field?

Define an action group (ALT-6):
Type: Format Value

  1. Action:
    Field: TRACK
    Format String: $num(%_filename%,2) or $left(%_filename%,2)

  2. Action:
    Field: TITLE
    Format String: $cutleft(%_filename%,2)

Or if you like a regular expression better:
Format value for TRACK:
Format string: $regexp(%_filename%,^(\d+).*,$1)

Format value for TITLE:
Format string: $regexp(%_filename%,^\d+,)

1 Like