Posts

Showing posts from November, 2016

Notepad++ Regular expressions

Notepad++ regular expressions For those of you that regularly use notepad++, you would have come across the "Regular expression" option on the Replace window. I'm sure the code will work for older versions, but I've tested and been using these against version 6.9.

As a developer, I've used this option to replace elements in my text files (example: replacing invalid date delimiter characters). Let me give you some tips on finding and replacing characters in files needed for processing:

Find what(\d{4}+)\.+(\d{2}+)\.(\d{2}+) Replace with: \1-\2-\3
Synopsis: We wish to search for a number (e.g. a date in our case), which starts off with 4 digits; followed by a decimal point; followed by 2 digits; followed by a decimal point; followed by 2 digits. We then wish to replace what was found with these these groups of numbers, separating them with a hyphen character.

The plus + symbol after each character group ensures the separate groups are looked at as a single string t…