Search code examples
regexnotepad++

wildcard search in notepad++ to get particular line if it matches any string between first and last search except whitespaces


  1. this is sample text jfhwkjefwl todo
  2. here sample text todo
  3. sample text todo

I want to select only the first statement "this is sample text jfhwkjefwl todo". I tried with different combination of [t][e][x][t].*[t][o][d][o] and [t][e][x][t ].*[t][o][d][o].

can one help me will be most appreciated.


Solution

  • Do you mean something like this?

    .*text\s+\S+\s+todo.*
    

    Means anything optional (.*) followed by "text" followed by at least one whitespace (\s+) followed by at least one non-whitespace (\S+) followed by at least one whitespace followed by "todo". So if you want to match the whole line then your regex have to match everything you want and not only a substring.