#1 2010-04-01 09:22

dodgy
Member
Registered: 2010-04-01
Posts: 9

Insert dash after track number

Hi (again),

I've another request if I may.

I'd like to be able to insert a dash ("-") following numbers where there isn't already one.

For example:

01.track1.mp3
02 - track 2.mp3
03 track 4.mp3
20  track 20.mp3
track25.mp3

Should become:

01-.track1.mp3
02 - track 2.mp3
03- track 4.mp3
20-  track 20.mp3
track25.mp3

So in other words:

- if a filename doesn't start with numbers, ignore it
- if the next character after the digits end is not a -, or a <space>- then add a dash after the number

I may be asking a bit much here, not sure it's possible, but here's hoping!

Many thanks

Offline

#2 2010-04-01 11:13

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: Insert dash after track number

Oh it's possible all right, don't you have doubts re. that! big_smile If not with RegEx (I'm sure one of our resident RegEx experts will be along to confirm soon smile), then most anything can be accomplished with a custom PascalScript. That's what makes ReNamer so powerful and almost infinitely extensible.

P.S. Came close with RegEx but bumped against the limits of my knowledge, so I'm sure PascalScript can be avoided in this case as well.

Offline

#3 2010-04-01 11:24

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,379

Re: Insert dash after track number

Using RegEx rule:
Expression: ^(\d+)[\s\-\.]*(.*)$
Replace: $1 - $2

Input:
01.track1.mp3
02 - track 2.mp3
03 track 4.mp3
20  track 20.mp3
track25.mp3

Output:
01 - track1.mp3
02 - track 2.mp3
03 - track 4.mp3
20 - track 20.mp3
track25.mp3

Offline

#4 2010-04-01 11:47

dodgy
Member
Registered: 2010-04-01
Posts: 9

Re: Insert dash after track number

Now that's just awesome ... thanks very much indeed for the help!

Offline

#5 2010-04-01 19:10

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: Insert dash after track number

LoL! When I said I "came close", Denis' output was exactly what I got, but I didn't paste it here 'cos it didn't exactly match the output you'd mentioned. Oh well! smile

Offline

#6 2010-04-01 19:57

dodgy
Member
Registered: 2010-04-01
Posts: 9

Re: Insert dash after track number

It was actually what I wanted, I just thought it'd be so hard I didn't ask for it :-)

I've got 24 rules in total that run (I'm sure I could cut it down if I were clever about it) .. and mostly my files are coming out fantastically now!

Offline

#7 2010-04-01 21:55

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Insert dash after track number

My two cent  smile

Using RegEx rule:
Expression: ^(\d+)\W*(.+)
Replace: $1 - $2


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

Board footer

Powered by FluxBB