Menu

how to select all lines containing a keyword

2008-06-03
2012-11-13
  • myxamor pizdyn

    myxamor pizdyn - 2008-06-03

    Notepad ++ has a function to search and replace. Now it would be great if there was a way to search and select all lines containing the keyword. i.e. milk is on line 69 78 101 322 so if i type search and select it would select all lines containing milk

     
    • pshute

      pshute - 2008-06-04

      "Still, you can use Notepad++'s extensive toolkit to achieve what you what."

      Good answer.  But myxador doesn't explain what he wants to do once he has selected all these lines.  Selecting non-contiguous lines isn't posible, as far as I know, so there's obviously more to the question.

      Perhaps myxador just wants to see where all the matches are.  If so, then enabling "Mark Line" and "Style found token" in the Find (control+F) dialog before clicking Find All should help.  Otherwise the URL Fool4UAnyway provided should help with most other possibilities.

       
      • Don HO

        Don HO - 2008-06-04

        > But myxador doesn't explain what he wants to do once he has selected all these lines.
        > Selecting non-contiguous lines isn't posible, as far as I know,
        > so there's obviously more to the question.

        If he want to do some operations on the marked lines, here's a good news :
        In Notepad++ v5, user can delete the marked lines and do copy/cut/paste from (or to) the clipboard on the marked lines.

        Don

         
      • Fool4UAnyway

        Fool4UAnyway - 2008-06-04

        > But myxador doesn't explain what he wants to do once he has selected all these lines.
        > Selecting non-contiguous lines isn't posible, as far as I know, ...

        It is possible, more or less, using TextFX Viz. That is, TextFX Viz allows you to copy the visible part of a selection. Of course one can copy matches and paste them into a new document.

        > Perhaps myxador just wants to see where all the matches are.

        I refer to a message that describes how you can "select" all those lines. I believe that is what myxador asks for.

        See also the message

        "RE: copy to clip all text matching regex pattern"
        http://sourceforge.net/forum/message.php?msg_id=4915652

        in the thread

        "copy to clip all text matching regex pattern" (Help forum)
        http://sourceforge.net/forum/forum.php?thread_id=2012623&forum_id=331754

         
    • Fool4UAnyway

      Fool4UAnyway - 2008-06-03

      Still, you can use Notepad++'s extensive toolkit to achieve what you what.

      See this message

      "RE: Need help using regex"
      http://sourceforge.net/forum/message.php?msg_id=4923889

      in the thread

      "Need help using regex" (Help forum)
      http://sourceforge.net/forum/forum.php?thread_id=2016115&forum_id=331754

      I believe soon it will be available to copy all found occurrences (in files, open files, or the current document) from the find results window.