moving part of filename to another location

A swapping-ground for Regular Expression syntax

Re: moving part of filename to another location

Postby PCMcB » Wed Oct 23, 2024 4:15 pm

Hello - I'm struggling to work out the code to move the parts I need in my file names (which vary in length).

I have:

054-RYD-00-XX-D-L-2000-C10-Proposed Sitewide Landscape Masterplan.dwg
054-RYD-00-XX-D-L-2100-C04-Hard Landscape General Arrangement Finishes.dwg

but need to move the "C10" to the end of the file name... note that the C10 can vary in number so sometimes it is C02, C03, etc and the end of the file name changes too.

I want:
054-RYD-00-XX-D-L-2000-Proposed Sitewide Landscape Masterplan-C10.dwg
054-RYD-00-XX-D-L-2100-Hard Landscape General Arrangement Finishes-C04.dwg

Can anyone help me with the code? I was hoping that Move/Copy would allow me to MOVE from X to X to end...
Thanks in advance!
PCMcB
 
Posts: 2
Joined: Wed Oct 23, 2024 4:08 pm

Re: moving part of filename to another location

Postby Admin » Wed Oct 23, 2024 11:51 pm

Try:

RegEx (1)

Enable Simple tick in RegEx (1)

Then

Match: %1-C%2-%3
Replace: %1-%3-C%2

This should work as far as -C does not appear in the first part of the name.
Admin
Site Admin
 
Posts: 2579
Joined: Tue Mar 08, 2005 8:39 pm

Re: moving part of filename to another location

Postby PCMcB » Thu Oct 24, 2024 3:34 pm

PERFECT! Thanks so much for your help!
PCMcB
 
Posts: 2
Joined: Wed Oct 23, 2024 4:08 pm

Previous

Return to Regular Expressions