Visual Studio has a nice feature to calculate the Lines of Code (LOC) in source files. But do you know that you can also use Notepad++ to find the Lines of Code (LOC) in your source files in a directory? Here we will show you how to do it.

 

How to count LOC with Notepad++

 

To find the LOC of your source files using Notepad++, you can follow the steps mentioned below:

  1. Open your Notepad++ instance.
  2. Press CTRL + SHIFT + F to open the "Find in Files" dialog.
  3. In the "Find what" input box, enter "\S+\s*$" as the regular expression to find out the lines containing some text.
  4. Select the "Directory" for which you want to search.
  5. Under the "Search Mode" section, select the "Regular expression" checkbox.
  6. Finally, click on the "Find All" button to start the search.
  7. Once the search completes, check the search result in the "Find result" panel to get the total LOC.

How to count LOC with Notepad++

 


Kunal Chowdhury

About the Author

Solution Architect & Former Microsoft MVP

Kunal Chowdhury is an enterprise solution architect and former multi-year Microsoft MVP. He is the author of three technical books: Windows Presentation Foundation Development Cookbook, Mastering Visual Studio 2017, and the Mastering Visual Studio 2019.

He publishes technical and non-technical articles on .