Community
    • Login

    Seach a word and pick the 100th result

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 4 Posters 2.2k 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.
    • TarıkT Offline
      Tarık
      last edited by

      I search a word in my notefile and i find 15000 results now I want to locate where is the 100th result in my notefile. How can i detect it ?

      1 Reply Last reply Reply Quote 1
      • Terry RT Offline
        Terry R
        last edited by

        @Tarık
        may I direct you to this posting.
        https://notepad-plus-plus.org/community/topic/16104/how-to-find-and-highlight-a-specific-occurance-of-a-symbol

        The question there fits what you are trying to do. Have a go using that information. If in doubt come back to us with what you have tried and also an example of the data if possible. Real data/examples are ALWAYS so much better to help out posters.

        Terry

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

          Hi, @tarik, @terry-r and All,

          From any starting point, in file, the generic regex (?s)(?:.*?(X)){N}.*?\K\1 will find the Nth occurrence of X, where X can be, either :

          • A simple character

          • A word => The regex \b<Word>\b

          • A string of characters

          • A regular expression


          For instance, the regex (?s)(?:.*?(\bthe\b)){9}.*?\K\1 would find, from current location, the 10th occurrence of the article the

          Cheers,

          guy038

          1 Reply Last reply Reply Quote 5
          • TarıkT Offline
            Tarık
            last edited by

            @guy038 said:

            (?s)(?:.?(\bthe\b)){9}.?\K\1

            Thank you for kindly answers. I don’t know where can I use this command in notepad++.

            Scott SumnerS 1 Reply Last reply Reply Quote 0
            • Scott SumnerS Offline
              Scott Sumner @Tarık
              last edited by

              @Tarık

              • Move your caret/cursor to the place where you want to start seeking the Nth match from
              • Invoke the Find dialog by pressing ctrl+f
              • Select Regular expression as the Search mode
              • Put an expression such as @guy038 's in the Find what zone
              • Tick the Match case checkbox if you want to…umm…only match the case of your text in the Find what
              • Press Find Next button

              Does that make it clear?

              1 Reply Last reply Reply Quote 3
              • TarıkT Offline
                Tarık
                last edited by

                Thank you all!

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

                  Hi, @tarik, @scott-sumner, @terry-r and All,

                  Thanks, Scott, for your additionnal information. Look like I was a bit tired to develop ;-))

                  Of course, as Scott mentioned, your can, either, perform a sensitive to case OR a insensitive to case search, with the respective generic regexes :

                  • (?s-i)(?:.*?(X)){N}.*?\K\1 ( Sensitive )

                  • (?si)(?:.*?(X)){N}.*?\K\1 ( Insensitive )

                  Cheers,

                  guy038

                  1 Reply Last reply Reply Quote 2

                  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