Community
    • Login

    Regex for end-of-file anchor

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    11 Posts 5 Posters 4.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.
    • EkopalypseE
      Ekopalypse
      last edited by

      There is indeed an issue, \' matches the end buffer and the other the start of buffer

      14a93da9-d909-4601-a063-084b6710bd54-image.png

      0fb69a35-aff1-426b-a314-bc9ea4db462e-image.png

      1 Reply Last reply Reply Quote 2
      • EkopalypseE
        Ekopalypse
        last edited by Ekopalypse

        @PeterJones - issue and pr opened.
        @M-Andre-Z-Eckenrode - thank you for reporting the issue.

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

          Hello, @m-andre-z-eckenrode, @ekopalypse, @peterjones and All ,

          The manual states :

          • \A or \' => The start of the matching string.

          • \z or \` => The end of the matching string.

          • \Z Matches like \z with an optional sequence of newlines before it. This is equivalent to (?=\v*\z), which departs from the traditional Perl meaning for this escape.

          Well, there is some typos here !

          Indeed, the correct text should be :

          • \A or \` or (?-m)^ => The start of the matching string.

          • \z or \' or (?-m)$ => The end of the matching string.

          • \Z Matches like \z with an optional sequence of vertical blank characters before it. This is equivalent to the assertion
            (?=[\n\f\r\x85\x{2028}\x{2029}]*\z), which departs from the traditional Perl meaning for this escape.

          So, @ekopalypse, there is absolutely no regex issue at all !!


          Notes :

          • For a correct behavior of the \A assertion, whatever its syntax, you must use, at least, Notepad++ v7.9.1

          • The \Z assertion is not stricly equivalent to (?=\v*\z) as the \v character class is identical to the [\n\x0B\f\r\x85\x{2028}\x{2029}] character class

          Best Regards,

          guy038

          EkopalypseE 1 Reply Last reply Reply Quote 1
          • EkopalypseE
            Ekopalypse @guy038
            last edited by

            @guy038

            ?? - but you yourself state that the documentation is wrong ??
            What am I missing??

            1 Reply Last reply Reply Quote 0
            • guy038G
              guy038
              last edited by guy038

              Hi, @m-andre-z-eckenrode, @ekopalypse, @peterjones and All,

              Sorry, @ekopalypse. I misspoke :

              Of course, an issue should be created to modify this part of the N++ official documentation !

              But, from a functional and regex point of view, the assertions \` , \' work properly and are identical, respectively, to the \A and \z assertions !

              BR

              guy038

              EkopalypseE 1 Reply Last reply Reply Quote 2
              • EkopalypseE
                Ekopalypse @guy038
                last edited by

                @guy038 - ok and I’ve created the issue and the pull request already. Just needs to be merged.

                PeterJonesP 1 Reply Last reply Reply Quote 1
                • Alan KilbornA
                  Alan Kilborn
                  last edited by

                  @guy038 said in Regex for end-of-file anchor:

                  The manual states :

                  \A or ’ => The start of the matching string.

                  \z or ` => The end of the matching string.

                  If the manual is being improved, how about really improving it?

                  “The start of the matching string” and “The end of the matching string” are not very good phrases for the Notepad++ user/manual.

                  I guess they work fine in the context of a programmer calling the Boost C++ function (where these phrases originated from, I think).

                  But why aren’t they referred to in the Notepad++ user manual as relating to start-of-file and end-of-file, respectively?

                  PeterJonesP 1 Reply Last reply Reply Quote 4
                  • PeterJonesP
                    PeterJones @Alan Kilborn
                    last edited by

                    @Alan-Kilborn said in Regex for end-of-file anchor:

                    But why aren’t they referred to in the Notepad++ user manual as relating to start-of-file and end-of-file, respectively?

                    Makes sense to me. @Ekopalypse , when you get a chance, could you update your PR?

                    1 Reply Last reply Reply Quote 2
                    • PeterJonesP
                      PeterJones @Ekopalypse
                      last edited by

                      @Ekopalypse ,

                      Thanks for PR#197. It has been merged, and will be in the next release.

                      @M-Andre-Z-Eckenrode ,

                      For now, you can see the updated docs in searching.md. The fixes will be in the live document the next time there’s a website release (probably after NPP v7.9.6 is released).

                      M Andre Z EckenrodeM 1 Reply Last reply Reply Quote 3
                      • M Andre Z EckenrodeM
                        M Andre Z Eckenrode @PeterJones
                        last edited by

                        @PeterJones and everyone else —

                        Looks good, thanks!

                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors