Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ Regex Find line containing a word and not containing a word

I want to use notepad++ and regex to find a line that contains the word g_n and does not contain the word thd.

I've been desperately trying to figure this out but with little luck. Can someone point me in the right direction? It would be greatly appreciated.

I know that I can use ^ to negate something.

like image 946
Neil Avatar asked Jun 02 '13 02:06

Neil


People also ask

How do I find a specific word in Notepad++?

It can be invoked directly with Search > Find or the keyboard shortcut Ctrl+F. Replace tab: Similar to Find tab, but allows you to replace the matched text after it's found. It can be invoked directly with Search > Replace or the keyboard shortcut Ctrl+H.

How do you search for a phrase in notepad?

Finding text in Notepad and WordPad The Ctrl + F and Command + F keyboard shortcut keys also work in Microsoft Notepad and Microsoft WordPad.

Can I use regex in Notepad?

Using Regex to find and replace text in Notepad++ In all examples, use select Find and Replace (Ctrl + H) to replace all the matches with the desired string or (no string). And also ensure the 'Regular expression' radio button is set.


1 Answers

I would imagine that this regex would work:

^(?!.*thd).*g_n.*$
like image 185
Niet the Dark Absol Avatar answered Sep 24 '22 08:09

Niet the Dark Absol