-1

I want to use the Eclipse search to find all method calls for a method which takes a variable argument count, like this: public void myMethod(String s, Object o, String... categories) and get all which have specific counts of the optional parameter at the end.

So for example i would like to find all occurrences of myMethod("test", niceObject) when i want those without any optional parameters. I know atleast this part can be done via regex, but this will stop working as soon as someone has split it up into multiple lines (or my regex-fu isn't strong enough :) ).

Any suggestions appreciated, be it using the eclipse built-in search functionality or a good regex which can deal with multiline method calls-

wlfbck
  • 554
  • 8
  • 22

2 Answers2

1

(?s)foo\(([^,]+,){2}[^,]+\); matches calls to a method foo with 3 parameters.

Here are the details:

Emmanuel Chebbi
  • 456
  • 3
  • 5
  • 13
1

Using the Eclipse File Search this one should work with multiline method calls (with 2 being the vararg count):

myMethod\([^,]+,[^,]+(,[^,]+){2}\)
Marek
  • 263
  • 1
  • 5
  • 13