Page 1 of 1

Move First Two Words to End of Filename

PostPosted: Tue Jul 09, 2019 10:39 pm
by Videoman22
I search the forum and couldn't find a solution to my problem. I have filenames that are formatted as follows

Jane Smith-1-2019
Jack Smith-5-1-2019
Thomas Smith-6-2019

My goal is for them to look like the following
1-2019-Jane Smith
5-1-2019-Jack Smith
6-2019-Thomas Smith.

So basically move everything before the first "-" to the end of the filename and insert another "-" or space.

Does anybody know how I might be able to do this? Thanks.

Re: Move First Two Words to End of Filename

PostPosted: Wed Jul 10, 2019 2:08 am
by therube
So basically move everything before the first "-" to the end of the filename and insert another "-" or space.


1:RegEx
Code: Select all
Match:  (.*?)-(.*)
Replace:  \2-\1


non-greedily match anything up to the first dash (-), \1, then match everything else, \2
reverse their positions, with a dash between

Re: Move First Two Words to End of Filename

PostPosted: Wed Jul 10, 2019 6:56 pm
by Videoman22
That worked perfectly. Thanks for the help.