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: 

^((?!xxx).)*\n

and just leave the replace box empty. 



14 comments:

  1. Replies
    1. Great Article android based projects

      Java Training in Chennai Project Center in Chennai Java Training in Chennai projects for cse The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training Project Centers in Chennai

      Delete
  2. 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

    |

    ReplyDelete
  3. 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

    ReplyDelete
  4. I like your all post. You have done really good work. Thank you for the information you provide, it helped me a lot. I hope to have many more entries or so from you.
    Very interesting blog.visit my wepsite https://vstking.net/


    JetBrains PhpStorm crack

    PhpStorm 2021.3 Crack

    ReplyDelete
  5. I like your all post. You have done really good work. Thank you for the information you provide, it helped me a lot. I hope to have many more entries or so from you.
    Very interesting blog.
    webstorm-activation-Free Download

    ReplyDelete
  6. Wow, amazing block structure! How long
    Have you written a blog before? Working on a blog seems easy.
    The overview of your website is pretty good, not to mention what it does.
    In the content!
    vstkey.com
    PhpStorm Crack

    ReplyDelete

  7. I guess I am the only one who came here to share my very own experience. Guess what!? I am using my laptop for almost

    the past 6 years, but I had no idea of solving some basic issues. I do not know how to

    Download Cracked Pro Softwares
    But thankfully, I recently visited a website named Crack Software Free Download
    All Pro Cracked Softwares Download
    PhpStorm Crack

    ReplyDelete
  8. Wow, amazing block structure! How long
    Have you written a blog before? Working on a blog seems easy.
    The overview of your website is pretty good, not to mention what it does.
    In the content!
    vstkey.com
    PhpStorm Crack
    Systools Pen Drive Recovery Crack
    Sonnox Oxford Reverb Crack
    plugin alliance all bundle Crack
    Overloud TH-U Full Crack
    Passport Photo Maker Crack

    ReplyDelete