Most computer programmers use more than one text editor. I have Notepad++, Sublime Text, Atom and Visual Studio Code installed on my computer. I don’t even really have a favorite. It depends what I am doing, but I find Notepad++ great for just processing simple text. Here’s an example.
I needed to document a SQL Server project I was working on and I wanted to have my T-SQL code properly syntax highlighted in m a Word file. After Googling that I found that Notepad++ can do the job.
- Paste your code in the window;
- Select the programming language from the language menu;
- Select the text to copy;
- Right click and select Plugin commands -> Copy Text with Syntax Highlighting;
- Paste it into MS Word and you are good to go!
Count Words
Do you need a quick way to count the number of words in your text? Set the search mode to regular expression, type in \w+ and click the Count button.
There are 14 words.
Replace Newline (CRLF) With Space
You have a text file that has several sentences and perhaps is divided into paragraphs. You’d like to clean it up and paste it into a word processor like Microsoft Word. It looks messy because part way through all of the sentences there are newline characters that push the text to the new line. You want the word processor to handle that for you. Before you paste the text into Word, you want to replace the newline characters with spaces. That’s easy with Notepad++ when you use regular expressions. Search for [\r\n], add a space to the Replace With box and check Regular Expression.