Notepad++ snippets

How to make all date parts two digits with Notepad++

Let say you have the following list of dates:

Notepad++ replace 1


01/06/2022
15/06/2022
30/12/2021
25/10/1985
01/01/2001

and you want transform them in order that every date part has at least two digits:

Notepad++ replace 3


01/06/2022
15/06/2022
30/12/2021
25/10/1985
01/01/2001
                            

To do this in Notepad++, you can just hit CTRL + H for Replace window and the select the following:

Notepad++ replace 2

  • Find what: \b(\d)(?=/)
  • Replace with: 0$1
  • Flag Regular expression
  • Do not flag . matches new lines

Back to Notepad++ cookbook page