Community
    • Login

    Broken repeat search using \A

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

      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 Offline
        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 Offline
          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 Offline
            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

            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