#1 2008-02-23 04:01

ffff1111
Member
Registered: 2008-02-23
Posts: 2

Remove track numbers

Hi! first of all... sorry for my bad english! roll

I want to remove the track numbers from the beginning of the filenames:
From...
08. Madonna - Like A Prayer.wma
08.-Madonna - Like A Prayer.wma
08 Madonna - Like A Prayer.wma
To..
Madonna - Like A Prayer.wma

The problem is that if I add a rule that remove "08"... then some songs like "Cascada - Cheri lady 2008 (Extended Bootleg Mix).mp3"
...would change to "Cascada - Cheri lady 20 (Extended Bootleg Mix).mp3"... and I don't want that.

And I don't want to use the DELETE function because I have other files that don't begin with the track number.

Is there any RegEx or Pascal script that removes numbers(+ some additional symbols like ".", "-", spaces..) FROM THE BEGINNING of the file?
Or maybe remove "08".. only if there aren't more digits on both sides.

Thanks!!!...and thanks for this program! is the best renamer I have used. wink

Last edited by ffff1111 (2008-02-23 04:05)

Offline

#2 2008-02-23 04:41

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Re: Remove track numbers

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

Which means:
^ - start of the text/filename
\d - any digit
[-. ]+ - any of chars "-", " ", "." repeated no matter how many times
(.+) - the rest of the filename

$1 - the part of filename which was in brackets () in regex. (so anything that match "(.+)" )

I suggest reading UserManual that is added to newest versions of ReNamer. Especially part named "Regular Expression".

Best regards,
Konrad


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

#3 2008-02-27 00:50

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

Re: Remove track numbers

Good man, krtek smile

Here is a slightly improved expression: \A[\d\-\.\s]+(.+)  and replace with $1

This will remove digits, dash, dot and space at the beginning of the filename, and it can be any number of digits.

So for all names like:

008. Madonna - Like A Prayer.wma
08 Madonna - Like A Prayer.wma
08. Madonna - Like A Prayer.wma
08.-Madonna - Like A Prayer.wma
Madonna - Like A Prayer.wma

You will get the same output:

Madonna - Like A Prayer.wma

Offline

#4 2008-03-02 01:52

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Re: Remove track numbers

You're right Denis.
It's better way to put \d into square brackets, as this notation is independent of number of digits in the beginning of the filename.
In my notation expression would be: ^[\d\s.-]+(.+)

So: \A is the same for ^
\s - is any of white signs (space, tab etc.)

In Denis's notation "\" is escape sign for any significant signs in regex (such as "." and "-").  But as long as "." sign is in square brackets it doesn't
have to be escaped. The same is about  "-" sign IF it's first or last sign in square brackets. And about "^" sign IF it's NOT first sign in square brackets.
Cheers


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

#5 2008-03-16 04:00

ffff1111
Member
Registered: 2008-02-23
Posts: 2

Re: Remove track numbers

Thanks a lot guys!
It works perfectly! smile

Offline

Board footer

Powered by FluxBB