Question about moving sections of file names

A swapping-ground for Regular Expression syntax

Question about moving sections of file names

Postby ajdedo » Tue Jun 18, 2019 9:18 am

Hi,

If I have file names like this ->

Numbers 12 - Colors Red - Letters ABCDE
Numbers 1234 - Colors Blue - Letters ABC
Numbers 12345 - Colors Green - Letters ABC
Numbers 123456 - Colors Yellow - Letters A

How can I rearrange the file name to look like this ->

Colors Red - Letters ABCDE - Numbers 12
Colors Blue - Letters ABC - Numbers 1234
Colors Green - Letters ABC - Numbers 12345
Colors Yellow - Letters A - Numbers 123456

Thanks.

P.S. After 15 years, this is still the only rename utility I use! :-)

P.P.S. The file names are actually more like this ->

<string of characters and words> - <string of characters and words> - <string of characters and words>
ajdedo
 
Posts: 2
Joined: Tue Jun 18, 2019 9:02 am

Re: Question about moving sections of file names

Postby therube » Tue Jun 18, 2019 4:12 pm

1:RegEx:
Code: Select all
Match:  (.*?)( - )(.*)
Replace:  \3 - \1
therube
 
Posts: 567
Joined: Mon Jan 18, 2016 6:23 pm

Re: Question about moving sections of file names

Postby ajdedo » Wed Jun 19, 2019 10:27 pm

therube wrote:1:RegEx:
Code: Select all
Match:  (.*?)( - )(.*)
Replace:  \3 - \1


Great Thanks!

I expanded what you taught me to give it more flexibility:

Match: (.*?)( - )(.*?)( - )(.*)

Replace: \1 - \5
Replace: \3 - \1
Replace: \5 - \1 - \3
etc....

Thanks!
ajdedo
 
Posts: 2
Joined: Tue Jun 18, 2019 9:02 am


Return to Regular Expressions