How to move characters from the end forward?

Bulk Rename Utility How-To's

How to move characters from the end forward?

Postby janus » Sun Jun 02, 2024 7:16 pm

Hello,
I am trying to figure out how I can move characters (or a string of characters, in this case the year in a date) from the end forward to a specified position but counted from the end and then move this new date completely behind the first word...?

I have a lot of files with this format:
AAA BBB CCC DDD ... MM DD YYYY.xyz

I would like to a) first move the YYYY in front of the MM DD and b) then (or simultaneously if possible?) move the whole YYYY MM DD set behind AAA.
The end result should look like this: AAA YYYY MM DD BBB CCC DDD ... .xyz

The problem is that I might be an experienced user but NOT a programmer... :? 8)
Any help in resolving this question would be very much appreciated. :D
janus
 
Posts: 3
Joined: Sun Jun 02, 2024 6:59 pm

Re: How to move characters from the end forward?

Postby Admin » Mon Jun 03, 2024 1:33 am

Hi, is there always a space between AAA and BBB, and is that always the first space in the file name?
Are there no spaces present in ... ?
If the file has a constant naming pattern, moving can de done with RegEx.
Admin
Site Admin
 
Posts: 2926
Joined: Tue Mar 08, 2005 8:39 pm

Move ending "mm dd yyyy" to 2nd-word as "yyyy mm dd"

Postby Luuk » Mon Jun 03, 2024 2:42 am

For the example, RegEx(1) could use a "Match" and "Replace" something like...
^(.+? )(.*)( \d\d \d\d )(\d\d\d\d)$
\1\4\3\2

If wanting that extra space at the end, can just add one to the end of your "Replace".
Luuk
 
Posts: 811
Joined: Fri Feb 21, 2020 10:58 pm

Re: How to move characters from the end forward?

Postby janus » Mon Jun 03, 2024 3:17 pm

Hi Admin & Luuk
thank you for the assistance.

Luuk:
That RegEx solution looks very promising... :) I will test it out.

Admin:
Yes, there is always a space between AAA and BBB and the other words (AAA BBB CCC ...)
'...' is a just placeholder for n other words.

On the topic of RegEx, I have to say that I don't know what that even is but it looks interesting and I would like to learn a little bit more about it.
Is there a recommended tutorial for rookies? "RegEx for Dummies" or something like that? Youtube videos?
Thank you again.
janus
 
Posts: 3
Joined: Sun Jun 02, 2024 6:59 pm

Re: How to move characters from the end forward?

Postby janus » Mon Jun 03, 2024 3:28 pm

On the other hand, after watching just a 2 minute video about RegEx :shock: it would probably be better if there were an AI solution that could help users like me...? :lol:
janus
 
Posts: 3
Joined: Sun Jun 02, 2024 6:59 pm


Return to How-To