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. 



10 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. 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
  3. 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
  4. 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

  5. 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