Help modify regex for moving dates to the end of filename

Bulk Rename Utility How-To's

Help modify regex for moving dates to the end of filename

Postby SeismicVoice » Fri Jun 09, 2023 4:48 am

I have a bunch of folders with photo files with filenames like the following:

AAAAAAA BBBB ## ## ## CCCCCC DDDDD
EEEEE ## ## ## FFFFFF GGGGG
HHHH IIIII ## ## ## JJJJJ

I would like to have a regex which will modify the date and move it to the end of a filename like so:

AAAAAAA BBBB CCCCCC DDDDD 20##-##-##
EEEEE FFFFFF GGGGG 20##-##-##
HHHH IIIII JJJJJ 20##-##-##

I managed to write a regex for the date format I want but I need help so that it's placed at the end of a filename.

Code: Select all
match:
(\d\d) (\d\d) (\d\d)
replace:
20\1-\2-\3

with the v2 box checked

I'd appreciate it if you could help me out. Thanks
SeismicVoice
 
Posts: 4
Joined: Fri Jun 09, 2023 4:23 am

Regex modify and move dates to end

Postby Luuk » Fri Jun 09, 2023 7:28 am

Can use a "Match" and "Replace" looking something like...
(.+) ([0-2]\d) (\d\d) (\d\d)( .+)
\1\5 20\2-\3-\4

Or with "v2" the "Replace" can also use $GroupNumbers instead of \GroupNumbers.
Luuk
 
Posts: 705
Joined: Fri Feb 21, 2020 10:58 pm

Re: Regex modify and move dates to end

Postby SeismicVoice » Fri Jun 09, 2023 12:26 pm

Luuk wrote:Can use a "Match" and "Replace" looking something like...
(.+) ([0-2]\d) (\d\d) (\d\d)( .+)
\1\5 20\2-\3-\4

Or with "v2" the "Replace" can also use $GroupNumbers instead of \GroupNumbers.


Works like a charm. Thanks so much! :D
SeismicVoice
 
Posts: 4
Joined: Fri Jun 09, 2023 4:23 am


Return to How-To