Thursday, 8 January 2015

IntelliJ find and replace: How to remove all lines not containing a certain text

This is essentially just an exercise in Regex but it's a little tricky (at least I found it non-trivial).

Supposing you want to remove all lines not containing xxx this is how you would go about it.

In the find box type: 


and just leave the replace box empty. 


  1. The great information that you shared. It will help all of them. Thanks for posting. Keep maintain the updates
    PHP Development Company
    Ecommerce Solution Provider
    Data Extraction Solutions


  2. 77%OFF Coach Outlet Store-Coach Bags Clearance Sale,100% Popular
    New & Popular Ray Ban Sunglasses Outlet Store Online,2020-2021 Stylish
    Clearance Coach Store | 80%OFF Coach Bags Outlet On Sale Online
    Share Best Best Adidas Yeezys Store|100% New & Real Yeezy Boost For Sale
    2020 Nike Air For 1 Shoes Outlet For Men & Women, 68-85%OFF Cheap Sale
    Official Michael Kors Outlet Store Online,100% Cheap MK Bags Sale
    61-82%OFF Air Jordan Shoe Stores|Cheap Jordans Releases,Hot Sale