Search code examples
searchtextcopynotepad++line

Copy and mark more than one line at once in notepad++


I have a big text file in which I search for lines I need to delete. I manually copy one line than put the mark button and repeat it again, I want to know if it possible to put all lines or at least more than one and mark it all? Maybe something in this way - word1>word2>word3 ets I don't know all combinations sorry All words (lines) are unique so recording a marco is not a solution.

My text

word1 
word2
word3
word4
word5
word2
word5
word4

I need to mark lines - word1, word2, word5 I do it manually one by one but I want to mark them all at once, maybe there is a regex for this I'm not sure like [word1, word2, word5] in the Find what area


Solution

  • If the number of words is not too big, you can do:

    • Ctrl+M
    • Find what: \b(?:word1|word2|word5)\b
    • TICK Match case
    • Mark all

    Explanation:

    \b          # word boundary
    (?:         # non capture group
        word1       # word1
      |           # OR
        word2       # word2
      |           # OR
        word5       # word3
    )           # end group
    \b          # word boundary
    

    Screenshot:

    enter image description here