#1 2022-11-14 20:01

Molodoi155
Member
Registered: 2022-11-14
Posts: 2

Moving specific portions of a file name

I am a newbie to the program and have reviewed the prior posts on RegEx, etc. that allow you to move/swap certain part of a file name but still do not fully understand/can get it to work.

Assume I have the following file name
420-001-corr-filename-2019-03-29

I want to move the date to be after the word "corr"
420-001-corr-filename-2019-03-29

The length of the filename may vary from file to file.
The date is always in YYYY-MM-DD format.
The beginning of the file name will always be in the same format (XXX-XXX); although the actual numbers will differ from file to file.
I think I need to count the characters from the end and then insert at character 13.

Any help would be greatly appreciated.

Offline

#2 2022-11-14 21:26

jogiwer
Member
From: Germany
Registered: 2022-11-05
Posts: 66

Re: Moving specific portions of a file name

Try the Regular Expression rule with:

(corr)(-.*)(-\d\d\d\d-\d\d-\d\d)
$1$3$2

Basically this will find the "corr"-part($1), the date-part($3) and the part inbetween ($2) and puts it into the wanted order.

Offline

#3 2022-11-15 04:46

Molodoi155
Member
Registered: 2022-11-14
Posts: 2

Re: Moving specific portions of a file name

Incredibly helpful, @jogiwer! Thank you!!
It works as I need. Again, thank you. It was also very helpful you noted which part is which. I will need to read up about Regular Expressions.

Offline

Board footer

Powered by FluxBB