Moving last few character to the front

Advanced Renamer forum
#1 : 31/03-19 03:09
jchong
jchong
Posts: 5
Hello,

I'd like to move the last few characters of a file name to the front. Examples:

my cool file name
my cool cool file name
my cool cool cool file name

In all 3 examples above, I want to move "name" to the front, so it becomes:

name my cool file
name my cool cool file
name my cool cool cool file

In other words, to move the last 4 characters of the file name to the front. There is no fixed pattern or length in the file name.

Would appreciate some help on how to do this. Thanks!


31/03-19 03:09 - edited 31/03-19 03:18
#2 : 31/03-19 04:31
David Lee
David Lee
Posts: 217
To do exactly what you ask - ie move the last 4 characters plus a space to the beginning of the name - use the Replace method with a Regular Expression:

Replace: (.*)(.{4})
with: \2 \1

However this will leave a space at the end of the filename - to remove this use:

Replace: (.*) (.{4})
with: \2 \1

A more general solution that will move all characters following the final space (ie the last word of any length) to the beginning is simply:

Replace: (.*) (.*)
with: \2 \1


31/03-19 04:31
#3 : 31/03-19 07:51
jchong
jchong
Posts: 5
Thanks for the help! I will try that out.


31/03-19 07:51