Thứ Tư, 25 tháng 11, 2020

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.

     

    Share This!


    Không có nhận xét nào:

    Đăng nhận xét