Move Around Complex Parts of Filename

A swapping-ground for Regular Expression syntax

Move Around Complex Parts of Filename

Postby sadsack5000 » Wed Jun 21, 2017 9:27 am

Hello all,

I have four different types of file I want to do some major changes to
Here are some examples of what I've currently got:
3400-DL-027 - 20170117.pdf
3E-1104A-E1 - 20170430.pdf
1V-1900 - 20161230.pdf

and I want to change them all to the likes of:

The XXX's are literal - they will be numbers added manually later (no way to automate getting those numbers)
The 16 or 17 at the back end of the file are the two digits from the year

Anyone up for a challenge?
Thanks in advance
Posts: 4
Joined: Thu Jun 15, 2017 12:21 am

Re: Move Around Complex Parts of Filename

Postby KenP » Wed Jun 21, 2017 12:39 pm

This works with the 3 examples you've given.

RegEx (1)
Match: ^([^-]*)-([^-]*)-?([^-]*)\s-\s\d{2}(\d{2})\d{4}$
Replace: GGP-\1\2\3-WOXXXXXX-\4IXX
Posts: 198
Joined: Sat Jul 30, 2016 11:25 am

Return to Regular Expressions