regular expression search to get the line count in a text file
- Sean O'Shea
- Feb 4, 2023
- 1 min read
Running the regular expression search:
\S+\s*$
. . . in a text editor like NotePad++ will generate a count of the number of non-empty lines in a text file. The number of hits will be shown in the results pane below the transcript.

In order to get a count of the number of empty lines you can run this RegEx search: ^\s*$

. . . but note that it will count consecutive lines with only whitespace as a single line.