Community
    • Login

    Broken repeat search using \A

    Scheduled Pinned Locked Moved General Discussion
    4 Posts 2 Posters 412 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

      I’ve noticed that in N++ 8.6.4, if I do a regular-expression search for \A on a non-empty document, all goes well (i.e., 1 hit), but then if I repeat that Find All in Current Document search immediately (i.e, without changing anything) then I get nothing (i.e., 0 hits).

      99b17ce4-c34f-40f2-aad8-8f1314bbae32-image.png

      What do others that care to comment think?
      Has this oddity been discussed before?

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

        @Alan-Kilborn I can confirm that this happens in 8.6.5 Release Candidate as well.

        Further testing suggests that the odd behavior is triggered by a search that results in a single, zero-length match at the very beginning of a file. (It doesn’t have to be \A; for example, a look-ahead that only matches in that position will do.)

        Following that, the next Find All will ignore a zero-length match at the beginning of the file (though other matches, if any, including zero-length matches not at the beginning of the file, will still be reported).

        I haven’t found the time and concentration yet to see if there is an identifiable reason in the code. It’s definitely unexpected behavior, but it’s also a very obscure set of circumstances that trigger it.

        Alan KilbornA 1 Reply Last reply Reply Quote 3
        • Alan KilbornA
          Alan Kilborn @Coises
          last edited by Alan Kilborn

          @Coises said in Broken repeat search using \A:

          it’s also a very obscure set of circumstances that trigger it.

          I noticed it when I was trying to get a hit on every file in a directory tree matching a specific Filter using Find in Files, so that I could use the Copy Pathnames feature of Search results right-click menu.

          It was the most “obvious” search I thought of doing, although later (after the strange behavior noticed) I changed to \z and that worked (on a repetitive basis) to achieve my goal.

          Neither \A (first time) nor \z works on zero-length files, though. I suppose I can accept that a search that is supposed to find something, doesn’t find that certain something, because it is searching a void.


          I suppose I should create an official issue about this.

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

            Issue submitted:

            FindAll with single zero-length match at start-of-file breaks subsequent same search

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