Moving a Date to the Front of the File Name

A swapping-ground for Regular Expression syntax

Moving a Date to the Front of the File Name

Postby exilekiller » Sat Jun 10, 2017 12:52 am

Hi all,

I have a ton of file names that have the date in the middle of the file name. I need it moved to the beginning. The dates are all in between "_ _"

Here is an example

Client_2343421_04.21.17__12123.00.pdf
SecondClient_1334_09.31.16__300.00.pdf

What I need

04.21.17_Client_2343421_12123.00.pdf
09.31.16_SecondClient_1334_300.pdf


Thank you ahead of time
exilekiller
 
Posts: 2
Joined: Sat Jun 10, 2017 12:46 am

Re: Moving a Date to the Front of the File Name

Postby Admin » Sat Jun 10, 2017 3:45 am

Hi, do the dates have all the same format? Which format? thanks
Admin
Site Admin
 
Posts: 1504
Joined: Tue Mar 08, 2005 8:39 pm

Re: Moving a Date to the Front of the File Name

Postby exilekiller » Sat Jun 10, 2017 8:12 am

the date format is as shown. month.day.year example 09.27.17 american formatting
exilekiller
 
Posts: 2
Joined: Sat Jun 10, 2017 12:46 am

Re: Moving a Date to the Front of the File Name

Postby KenP » Sat Jun 10, 2017 9:14 am

This will move the date to the front of the file name.

RegEx (1)
Match: (.*)_(\d{2}.\d{2}.\d{2}_)(.*)
Replace: \2\1\3
KenP
 
Posts: 198
Joined: Sat Jul 30, 2016 11:25 am


Return to Regular Expressions