strip leading 5 characters, take mm-dd-yy at end and move

A swapping-ground for Regular Expression syntax

strip leading 5 characters, take mm-dd-yy at end and move

Postby brian_p » Wed Feb 25, 2015 12:56 am

I am new to Regex and having trouble with what is probably a simple expression to simple to someone familiar. I want to rename files with syntax like:
67650454_All Fraud Reporting Privacy Event.doc__v1_10-09-10.doc to
2010-10-09_All Fraud Reporting Privacy Event.doc__v1_10-09-10.doc
Would like to remove leading fixed 9 characters, take mm-dd-yy (always) at end and move to front in yyyy-mm-dd so they sort properly.
Any help would be much appreciated.
Thanks, Brian
brian_p
 
Posts: 1
Joined: Wed Feb 04, 2015 1:17 am

Re: strip leading 5 characters, take mm-dd-yy at end and move

Postby bitmonger » Thu Apr 02, 2015 1:49 am

One point is confusing me - the title says strip 5 leading characters, the 5th line of the explanation says to remove the leading 9 characters, and the example shown removes 8 characters.
Assuming the example is right (8 characters), and the leading characters are always numbers the following will do the trick:

Use the RegEx section of Bulk Rename
Leave Include Ext. unchecked
RegEx (1)
Match \d\d\d\d\d\d\d\d(.*v1_)(.+)

\d means a single number digit. If the number of leading digits you want stripped is different than the 8 shown you will change the match string.

Replace 20\2\1\2

Hope this helps,
Bit
bitmonger
 
Posts: 50
Joined: Sat Sep 22, 2007 5:05 am


Return to Regular Expressions