Friday, February 20, 2009

Negative search

Dimitrios Kolovos posted a while ago a plugin to allow negative searches within Eclipse (how to find a file that does not contain a given String). I didn't want to install yet another plugin in my Eclipse and thought that regexes should allow for this.

Well they do :) here's a regex that will match any file if it does not contain "Copyright" (can be quite useful, that :p).

(?s)\A((?!Copyright).)*\Z

3 comments:

  1. They do indeed :) It seems I should dust off my regexp skills. Thanks for sharing this!

    ReplyDelete
  2. I used your plugin for a while before finding that one too, just that I change eclipses too often and was looking for a faster method :).

    ReplyDelete