Moving the four digit year in a filename from middle to end

A swapping-ground for Regular Expression syntax

Moving the four digit year in a filename from middle to end

Postby tonyaldr » Tue Nov 10, 2020 7:05 am

I've been having no luck with trying to rearrange the file names of about 100 files and hope that someone can give me some help. Two of the files are currently named -
Sounds of the 70's Vol 26- FM Rock II - (01) Beck, Bogert and Appice (1973) - Superstition.mp3
Sounds of the 70's Vol 26- FM Rock II - (02) Santana (1971) - Everybody's Everything.mp3

I'm trying to change the names to -
Sounds of the 70's Vol 26- FM Rock II - (01) Beck, Bogert and Appice - Superstition (1973).mp3
Sounds of the 70's Vol 26- FM Rock II - (02) Santana - Everybody's Everything (1971).mp3
Appreciate any advice! Thx!
tonyaldr
 
Posts: 2
Joined: Tue Nov 10, 2020 6:52 am

Re: Moving the four digit year in a filename from middle to end

Postby therube » Tue Nov 10, 2020 5:55 pm

I think this will do it:

1:RegEx
Code: Select all
Match:  (.*)\s(\(\d\d\d\d\))\s-(.*)
Replace:  \1\3 \2


Match everything up to
(ignore <space>)
Match (YEAR)
(ignore <space><dash>)
Match everything else

Rearrange


(One of the other RegEx options may be "simpler", but I can't check that.)
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Moving the four digit year in a filename from middle to end

Postby tonyaldr » Fri Nov 13, 2020 6:36 am

Almost perfect! The only thing is I had to add a - to get the separation between artist and song. So it would be \1-\3 \2. Thanks!!
tonyaldr
 
Posts: 2
Joined: Tue Nov 10, 2020 6:52 am


Return to Regular Expressions


cron