Help - Search - Members - Calendar
Full Version: A way to add a 0 to track number?
Mp3tag Forums > Mp3tag - International > Support
ManoMusic
Hey guys, I am new to this scripting stuff but I am doing my reading and trying to figure it out.
OK, what I would like to do is add a 0 to numerals 1-9 in the track #.

So, if we have 1,2,3,4,5,6,7,8,9,10,11,12..etc for track numbers.

It will modify them to

01,02,03,04,05,06..etc.

Any suggestions guys?
stevehero
QUOTE (ManoMusic @ Apr 29 2012, 20:52) *
Hey guys, I am new to this scripting stuff but I am doing my reading and trying to figure it out.
OK, what I would like to do is add a 0 to numerals 1-9 in the track #.

So, if we have 1,2,3,4,5,6,7,8,9,10,11,12..etc for track numbers.

It will modify them to

01,02,03,04,05,06..etc.

Any suggestions guys?

Here's two way of doing the same job.


Action #1:
Action type: Format value
Field: TRACK
Formatstring: $num(%track%,2)

Enter in where it says 2 how many leading zeros you want.


Action #2:
Action type: Replace with regular expression
Field: TRACK
Regular expression: ^(\d)$
Replace matches with: 0$1
[ ] case-sensitive comparison

This uses a regular expression in the TRACK field.

^ MATCHES the start of the string
( STARTS capture
\d MATCHES any digit 0-9
) ENDS capture
$ MATCHES end of string.

The replace is:
0 Self explanatory
$1 Returns the single no. that was captured
ManoMusic
Thanx alot for the help!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.