Page 1 of 1

Need a bit of help with a batch file rename...regex maybe?

Posted: 08 Dec 2006 18:28
by j_c_hallgren
Got a number of music files that are presently named in the format:
nnnn - 99 - xxxxxxxxxxxxxxxxxx.mp3
where nnnn is four char (no more, no less) clue to album name
and 99 is track nbr
and xxxxxxxxxx is track name of varying length

Desired output format is reversed somewhat:
xxxxxxxxxxxxxxx - nnnn - 99.mp3

Can this be accomplished with XY? Without a lot of manual effort?
Thanks!

(I'm trying to locate similar but not exact same track names on various albums)

Posted: 08 Dec 2006 18:42
by jacky
Yeah regexp can do this, I think this one shoud do it:

Code: Select all

(.{4}) - ([0-9]+) - (.+)\.(.+)>$3 - $1 - $2.$4

Posted: 08 Dec 2006 19:00
by j_c_hallgren
:D Worked like a charm! THANKS!! 8)

Maybe you'd add this to wiki as another example??

And the speed of your reply was much appreciated!

Posted: 08 Dec 2006 21:23
by jacky
Glad I could help 8)

Regarding the wiki, yeah I was actually thinking maybe on the RegExp page itself a section full of various examples, of both "selecting" regexp (for VF, etc) and "replacing" VF (for rename operations) could be a nice thing to add, since many would like it it seems.

So if you guys have regexp's to add, go ahead! ;)

Posted: 08 Dec 2006 21:56
by j_c_hallgren
Jacky, I'd suggest: take above example and make a sample entry on wiki of how you'd prefer it look...then others can add in similar format...

Posted: 09 Dec 2006 07:05
by admin
j_c_hallgren wrote:Jacky, I'd suggest: take above example and make a sample entry on wiki of how you'd prefer it look...then others can add in similar format...
And, I have said it before somewhere: I have no big idea of regexp myself but if someone would provide me a comprehensive list of good regexp examples, I will add a "Hints" button right on the RegExp Rename dialog.

Posted: 09 Dec 2006 17:50
by John Bee
admin wrote:... a comprehensive list of good regexp examples, I will add a "Hints" button right on the RegExp Rename dialog.
This "Hints" button I like. Want to see it everywhere. For the people like me, who can't remember from one moment to the next.

Can always use a hint, especially when dealing with the strange but powerfull RegExp.

Even looking at the example above by Jacky, it took me awhile to figure it out. (having the before and after helps)

John (what was I talking about again? :lol: )