Community
    • Login

    Ignoring empty lines counting

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    24 Posts 9 Posters 15.5k 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.
    • Alan KilbornA Offline
      Alan Kilborn
      last edited by Alan Kilborn

      I’ll create an issue if you haven’t already…

      The issue that was opened:

      https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13608

      1 Reply Last reply Reply Quote 3
      • guy038G Offline
        guy038
        last edited by guy038

        Hi, @mark-olson, @alan-kilborn and All,

        Did you notice this fact :

        • The regex ^$, indeed, does not count true empty lines !

        but :

        • The regex ^\R does count empty lines !!

        BR

        guy038

        Alan KilbornA 1 Reply Last reply Reply Quote 1
        • Alan KilbornA Offline
          Alan Kilborn @guy038
          last edited by

          @guy038 said in Ignoring empty lines counting:

          The regex ^$, indeed, does not count true empty lines !

          but :

          The regex ^\R does count empty lines !!

          If the regex is purely an assertion, e.g. ^$ or \b (to name but two), then its match won’t be counted by Count.

          CoisesC 1 Reply Last reply Reply Quote 5
          • CoisesC Offline
            Coises @Alan Kilborn
            last edited by

            @Alan-Kilborn said in Ignoring empty lines counting:

            @guy038 said in Ignoring empty lines counting:

            The regex ^$, indeed, does not count true empty lines !

            but :

            The regex ^\R does count empty lines !!

            If the regex is purely an assertion, e.g. ^$ or \b (to name but two), then its match won’t be counted by Count.

            True (since a pure assertion is always an empty match), but empty matches aren’t counted regardless of how the regular expression is specified. In a file that has empty lines, but no lines containing only capital Ws, ^W*$ counts zero matches. ^\R counts all empty lines (except the last line, if it’s empty) because it isn’t an empty match: it matches line ending characters. ^.*$ and ^.+$ both count all lines that are not empty.

            1 Reply Last reply Reply Quote 3

            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