Saturday, May 23, 2015

How to find lines not containing (matching) a string in Notepad++

 In Notepad++, you might have a requirement to find or replace lines which do NOT match a particular string.
Lets say you have the following lines in your text file - and you would like to the find lines NOT containing the string "USA"

Apple - USA
Airbus - France
Google -USA
IBM - USA
SAP - Germany
TESCO - UK


For this, you will have to use the Notepad++ Regex find option

Here's how:
  • Press Ctrl + F to pop open the Find dialog box
  • Select the Regular Expression radio button
  • Type in the find box : ^(?!.*USA).*$ 
  • Now find or replace.
Here are couple of awesome books to understand more about Regular expressions :

Here's a screenshot of my notepad++ screen.

 

3 comments:

Tom said...

How did you get that extra view at the bottom showing the results of the search?

custom writing service reviews said...

I don’t use notepad but I’m sure you helped all those who were facing this problem. Thank you for posting clear, step by step instructions.

fabyannahobando said...

Casino, Racetrack and Poker - Mapyro
Casino, Racetrack and 파주 출장안마 Poker is 안성 출장마사지 the only place in New 경산 출장마사지 Jersey to find the best games, 서귀포 출장마사지 tournaments, and dining options. Visit our website 거제 출장샵 for information and