I'm struggling to solve this problem in Notepad++. I'd really appreciate a good answer.
Let's say I have this line:
INSERT INTO example VALUES ('P1', 'V1', '27-Apr-2004', 20.00, '123', '1234');
And I want to get this:
INSERT INTO example VALUES ('P1', 'V1', '2004-04-27', 20.00, '123', '1234');
How can I do this for all lines in Notepad++? I've tried different kind of things but I couldn't get this result.
27-Apr-2004
would become2004-Apr-27
, then use 12 separate replacements for the month names, i.e. replace-Apr-
with-04-
etc. If a leading 0 is necessary for the day, you might need another regex replacement. The whole taskmight be easier to solve with a script (awk, perl, python, ...).cast('27-Apr-2004' as date)
. Find what would then be('\d{1,2}-\l{3}-\d{4}')
, and Replace with:cast\(\1 as date\)