Community
    • Login

    Customizable output for Find All in Current Document output window?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 2 Posters 1.6k 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.
    • Greg WernerG
      Greg Werner
      last edited by Greg Werner

      Undeniably, I use this feature all the time. What I get in the output is the line number, the text of the entire line and one (and only one) occurrence highlighted in that line. So if the line has multiple matches, the sentence will be duplicated with the next match highlighted.

      What would really be he helpful to me it to have the character offset given for match. With this, one would not need to duplicate the lines, instead one could give line # as well as character offset. In any event, displaying the character offset in some form would be immensely helpful.

      Can I change the output information for find all in current document, and specifically, can I get this character offset information for each match (without going and clicking on each link and recording the information)?

      Claudia FrankC 1 Reply Last reply Reply Quote 1
      • Claudia FrankC
        Claudia Frank @Greg Werner
        last edited by

        @Greg-Werner

        no, afaik not - May I ask you what exactly you want to do maybe there is another way to do it.

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 1
        • Greg WernerG
          Greg Werner
          last edited by

          For all occurrences in a file of a particular string match, I would like to get the start and end offset from the beginning of the document. I suppose this is a question as much about Notepad++'s ability to work with character offsets as it is for customizing the find output.

          Claudia FrankC 1 Reply Last reply Reply Quote 2
          • Claudia FrankC
            Claudia Frank @Greg Werner
            last edited by

            @Greg-Werner

            I assume that this isn’t solveable with pure native npp functionality,
            but if you would install the python script plugin you could use a script like

            matches=[]
            editor.research('text-string-to-find', lambda m: matches.append(m.span(0)))
            print matches
            

            which would return something like this

            [(14, 33), (84, 103), (124, 143)]
            

            with a document like this

            <record>
            aa
            text-string-to-find
            </record>
            test
            <record>
            a
            </record>
            <s>
            a
            text-string-to-find
            </s>
            <record>
            a
            text-string-to-find
            </record>
            

            If you want to go this way, let me know.

            Cheers
            Claudia

            1 Reply Last reply Reply Quote 2
            • Greg WernerG
              Greg Werner
              last edited by

              For the python plugin, is there an x64 version? I downloaded the plugin and it tried to install it into a my Program Files (x86) directory, but my Notepad++ is x64.

              Claudia FrankC 1 Reply Last reply Reply Quote 1
              • Claudia FrankC
                Claudia Frank @Greg Werner
                last edited by

                @Greg-Werner

                Yes there is, the easieast would be using the plugin manager.
                In case you don’t have it - see here.

                In case you want to use msi or do it manaually here are the current releases
                https://github.com/bruderstein/PythonScript/releases

                Cheers
                Claudia

                1 Reply Last reply Reply Quote 1
                • Greg WernerG
                  Greg Werner
                  last edited by

                  Thanks, didn’t realize Plugin Manager was gone. Once I installed that, I was able to install Python Script and that should be enough to get me on my way. Thanks again.

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