Count Blank Rows
-
Hi all,
Using Npp v7.9.5.
How do I count blank rows?
I tried Ctrl+F with Regex but I’m getting no result or incorrect result.
My RegEx pattern: ^\s*$What else can I do to get count of blank rows
Thanks
-w -
Maybe change your regular expression to
^\s*\R?Here are my Count results for the
license.txtfile that ships with Notepad++:
-
@dataprose said in Count Blank Rows:
Hi all,
Using Npp v7.9.5.
How do I count blank rows?
I tried Ctrl+F with Regex but I’m getting no result or incorrect result.
My RegEx pattern: ^\s*$The token
\smeans any whitespace, including newlines. With the asterisk, it means 0-or-more-as-many-as-possible. So that expression would matches consecutive newlines as a single match - so 100 blank lines in a row would count as one match.You either want it non-greedy using
^\s*?$or you want to match only zero-or-more horizontal spaces on a line, with^\h*$ -
@alan-kilborn said in Count Blank Rows:
Maybe change your regular expression to ^\s*\R ?
Yea…my advice was bad. :-(
It will count several blank lines in a row as one.
Go with the Peter solution.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login