1

I have a load of files with the date in the format 01-Feb-01 however need in the format 01/02/01. I've come across examples where the month is just 2 digits but how do i handle months with 3 letters?

Thanks.

Sae Us
  • 277
  • 1
  • 6
  • 21
  • Do you want to rename files, or do you want to change dates on lines within the files? A date like `01/02/01` is confusing, should it be interpreted as **mm/yy/dd** or as **dd/mm/yy** or **yy/mm/dd**, etc. – AdrianHHH May 22 '13 at 11:40
  • Want to change dates on lines within files. Btw I agree the date format is not perfect, its just what I have. – Sae Us May 22 '13 at 11:49
  • Notepad++ has a 'replace in files' facility within its search and replace commands. You could replace `-Feb-` with `/02/` and then eleven more similar replaces for the other months. It may be better to do a regular expression replace such as `(\d)-Feb-(\d)` with `\1/02/\2` to avoid (eg) `early-may-flies` changing to `early-05-flies`. But all are hard work. Better, I think, it to extend the question into a programming language you are familiar with. – AdrianHHH May 22 '13 at 12:01

1 Answers1

2

Seems to me that there's no other way, than to make 12 replace in files for every month, with regex like this:

find what:

(\d{2})-jan-(\d{2})
(\d{2})-feb-(\d{2})

replace with:

\1/01/2
\1/02/2

And so on (ignore case option on, ofcourse). If there's a way to replace a list of subpatterns with a list of replacements, I'd happy to get to know it. But for now it's all I've got :).

AdamL
  • 12,421
  • 5
  • 50
  • 74
  • 1
    @rikozoid, see http://stackoverflow.com/questions/11389466/multiple-word-search-and-replace-in-notepad/16104946#16104946 – AdrianHHH May 22 '13 at 12:03