Search code examples
regexnotepad++

Notepad++ Regex replace containing certain string


I'm having a few problems with Notepad++ and Regexes. How would I be able to delete each 'thing' containing the term "deletethisone"?

thing
beforestuff deletethisone
endthing

thing
beforestuff notthisone
endthing

thing
beforestuff deletethisone
endthing

thing
beforestuff notthisone
endthing

I've got the ". matches newline" enabled, by the way.

If anyone could help with this then that'd be great.


Solution

  • thing(?=(?:(?!thing|endthing).)*?deletethisone).*?endthing
    

    Try this.See demo.

    http://regex101.com/r/vR4fY4/18