2

I want to run file search over files like the guy shown here. I want to find the files containing string1 and string2 . Not string1 or string2. And most importantly the strings can be on different lines. I searched SO for it but I only found it with or clause and the regex is for the same line. Can you help me?

What I am looking for is some like this.

However I am using windows and my options are limited. Can I achieve this on eclipse?

Community
  • 1
  • 1
cgon
  • 1,955
  • 2
  • 23
  • 37
  • I'm sorry but this doesn't really make much sense. Could you provide a real life example? Why note just use `grep` / external tool? Is it a feature you want to implement, or a feature you need? – Georgian Jan 06 '14 at 14:59
  • http://jgeeks.blogspot.com/2013/10/searching-multiple-words-in-multiple.html – cgon Jan 06 '14 at 15:15

1 Answers1

4

Press Ctrl+H. Go to File Search tab select/check the "Regullar Expression" button and in the Containing text text box, use the blow regular expression

(?m)(?s).*(string1).*(string2).* --> Searches string1 first then string2.

If you want string2 to be searched first then use (?m)(?s).*(string2).*(string1).*.

To know about (?m) and (?s) go here

Chandrayya G K
  • 8,719
  • 5
  • 40
  • 68