Community
    • Login

    Count Blank Rows

    Scheduled Pinned Locked Moved General Discussion
    4 Posts 3 Posters 2.1k Views 2 Watching
    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.
    • dataproseD Offline
      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 KilbornA PeterJonesP 2 Replies Last reply Reply Quote 0
      • Alan KilbornA Offline
        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 KilbornA 1 Reply Last reply Reply Quote 0
        • PeterJonesP Online
          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 KilbornA Offline
            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

            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
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors