I've started working at a new job, which it turns out has a giant pile of completely unorganized, non-standardized file names across a pile of directories (too many to do manually). Initially my plan was to use a simple VBA script to use string compare of the first 13 characters, then if they don't match, place a string with the ideal date format (utilising the date created of the document) at the front, but then I noticed several patterns already exist and by doing my original plan I would just be creating another problem in the future (by having incorrect date codes behind my ideal string). Therefor after research I realised Regex patterns should be the way to go.
My ideal starting format is this: "yyyy.mm.dd - " (ie. "2014.11.20 - " I tried creating my first expression to match this but have had no luck so far:
^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+
Can someone please tell me where I am going wrong? My search through online tutorials has left me more confused than when I started.
The plan from there is to match other common date formats (below) in the directories and replace them with the "ideal", any help with regex patterns that would identify them would be greatly appreciated.
"yymmdd " "yyyy mm dd - " "yyyymmdd " "yyyymmdd - "
My plan would be to use a simple IF vba function, finding which the name matches to and doing the neccessary VBA strings manipulations to create the correct, standard format.
For example if the current name of the file is this "141003 xxxxxx" it would be replaced with "2014.10.03 - xxxxx", etc.
Thanks very much for your help in advance.
([1-2][0-9])([0-9][0-9])\.(0[1-9]|1[0-2])\.(0[1-9]|[1-2][0-9]|3[0-1])if you want to exclude false positives such as2017.13.32