Help with scripting export configuration

I'm trying to make a few export configs for backing up my tags. Since I tag MP3s and FLACs differently, I'll be making two backup .txt files for every album, one in FLAC and one in MP3 format.

Now, I'm trying to figure out how to export MP3's %track% and %discnumber% tags in format #/# to %track% & %tracktotal% and %discnumber% & %disctotal%.

Any ideas?

TRACK <== '02/05' $regexp(%TRACK%,'^(\d+)/(\d+)$','$1') ==> '02' $regexp(%TRACK%,'^(\d+)/(\d+)$','$2') ==> '05' $regexp(%TRACK%,'^0*(\d+)/0*(\d+)$','$1') ==> '2' $regexp(%TRACK%,'^0*(\d+)/0*(\d+)$','$2') ==> '5'

DD.20140619.0730.CEST

... or ...

$trimRight($trimRight(%TRACK%,'0123456789'),'/') ==> '02' $trimLeft($trimLeft(%TRACK%,'0123456789'),'/') ==> '05' $trimLeft($trimRight($trimRight(%TRACK%,'0123456789'),'/'),'0') ==> '2' $trimLeft($trimLeft($trimLeft(%TRACK%,'0123456789'),'/'),'0') ==> '5' $trimLeft($trimLeft(%TRACK%,'0123456789'),'/0') ==> '5' $num($trimRight($trimRight(%TRACK%,'0123456789'),'/'),1) ==> '2' $num($trimLeft($trimLeft(%TRACK%,'0123456789'),'/'),1) ==> '5'

DD.20140620.0732.CEST

Thanks, that worked.

One more thing – tricky, again, because of MP3's "#/#" format in %discnumber%. Would it be possible to automatically add "(Disc #)" to name of exported file if there is more than 1 disc?

$ifgreater($num(%DISCNUMBER%,1),1,' (Disc '$num(%DISCNUMBER%,1)')',)

DD.20140619.2019.CEST

... or ...

$ifgreater($num($trimLeft($trimLeft(%DISCNUMBER%,'0123456789'),'/'),1),1,' (Disc '$num($trimRight($trimRight(%DISCNUMBER%,'0123456789'),'/'),1)')',)

DD.20140620.0708.CEST

That only looks at the part before the slash in #/#, so it doesn't check total number of discs.

Maybe I did not understand the problem?
Are you able to you rephrase what is and what is wanted?

DD.20140619.2323.CEST

I want to add "(Disc #)" to the name of the exported file if the album I'm exporting has more than 1 disc. For example "Tag backup - Album (Disc 2).txt".

This is pretty easy to do with FLAC because it keeps disc number and disc total in separate tags. For example:
Tag backup - %album%$ifgreater(%disctotal%,1, (Disc %discnumber%),).txt

But MP3 stores disc info in a single %discnumber% tag, in the format x/y, where x is current disc, and y is total number of discs.

So, I first have to check if y is greater than 1, and if it is, add " (Disc x)" to the filename.

You can check the first value x, and for this case you got a fitting format string.

DD.20140620.0658.CEST

You mean y? (x/y)

I noticed that you added another string to your previous post,
$ifgreater($num($trimLeft($trimLeft(%DISCNUMBER%,'0123456789'),'/'),1),1,' (Disc '$num($trimRight($trimRight(%DISCNUMBER%,'0123456789'),'/'),1)')',)

which does get y, and is exactly what I needed.
Thanks.

It does not matter what value you take for the requested purpose.
I used the first value x.

If you like the long formatstring, then use it, but the short formatstring delivers the same result.

DD.20140620.1221.CEST