Community
    • Login

    Ignoring empty lines counting

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    24 Posts 9 Posters 5.5k Views
    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
      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
        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
          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
            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
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors