Category: regular-expressions

Sep 03 2013

How to use Notepad++ to fix up clear out some numeric strings

I am writing a script that is a copy of another older script. As such I need to replace some floating point strings with an empty string (to speed up future updates to the script.)

Specifically I need to replace this…

‘90.12’) with this…

”)

Notepad++ to the rescue.

I opened up the Find/Replace dialog (CTRL-H) in n++ and set the Search Mode to Regular expression.

In the “Find what:” box I put this… ‘(\d{2}).(\d{2})’\)

In the “Replace with:” box I put this… ”\)

It worked perfectly!!

Seth

Oct 30 2012

How to use Notepad++ to fix invalid date formats.

I was just sent some xml files that had dates in this format…

31/09/2012 (dd/mm/yyyy)

This date format won’t work in some of our systems so I needed to change some of the dates to the format 09/31/2012 (mm/dd/yyyy).

Notepad++ to the rescue.

I opened up the Find/Replace dialog (CTRL-H) in n++ and set the Search Mode to Regular expression.

In the “Find what:” box I put this…
(\d{2})/(\d{2})/(\d{4})

In the “Replace with:” box I put this…
$2/$1/$3

It worked perfectly!!

Seth