I would do:
/public static \(\S\+\) \(\w\+\)(
or maybe more readable using super magic:
/\vpublic static (\S+) (\w+)\(
What I believe happen on your test is that .\{-}
is eating all the symbols you don't want (i.e: =
,
).
Before you enter the parenthesis it does not because it is not greedyof its non-greedy nature (\{-}
) and it. It doesn't have to eat to find the next space but. But has soon as you add the (
it has too to match and so it does.
You can analyse that by converting your search into a substituion:
:s/public static \(.\{-}\) \(\w\+\)(/1:\1, 2:\2/