Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Count Blank Rows

    General Discussion
    3
    4
    587
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dataprose
      dataprose last edited by

      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

      Alan Kilborn PeterJones 2 Replies Last reply Reply Quote 0
      • Alan Kilborn
        Alan Kilborn @dataprose last edited by

        @dataprose

        Maybe change your regular expression to ^\s*\R ?

        Here are my Count results for the license.txt file that ships with Notepad++:

        ea48bf95-b6df-4cdf-b844-a7e744e25dbf-image.png

        Alan Kilborn 1 Reply Last reply Reply Quote 0
        • PeterJones
          PeterJones @dataprose last edited by PeterJones

          @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 \s means 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*$

          1 Reply Last reply Reply Quote 2
          • Alan Kilborn
            Alan Kilborn @Alan Kilborn last edited by Alan Kilborn

            @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.

            1 Reply Last reply Reply Quote 1
            • First post
              Last post
            Copyright © 2014 NodeBB Forums | Contributors