Customizable output for Find All in Current Document output window?



  • 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)?



  • @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



  • 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.



  • @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



  • 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.



  • @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



  • 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.


Log in to reply