I have a large C++ code base that I'm doing some refactoring on where a number of functions have become redundant, and hence should be removed. So I would like to replace
MyFunc(Param)
with
Param
where Param could be a literal value, variable, function call etc... From the online help I gathered that the search parameters should be
MyFunc/({+}/(
and the replace parameters simply
/1
But this gives me a syntax error in my pattern. I'm new to search and replace with regex under visual studio. Can the above be easily achieved? I've had a look at similar questions on this site, which suggest I'm roughly on the right track, but seem to be missing something.
Edit: If you can answer the above, how about if it is part of a class deference, e.g.
MyClass.MyFunc(Param)
or
MyClass->MyFunc(Param)
(FWIW, I also picked up a copy of VisualAssist in the hope it could do this but it doesn't appear to be able to handle this situation).
Second edit: Thanks to Joe for the correct response, but for anyone else using this approach, beware of some pitfalls,
MyFunc(MyArray[MyOtherFunc(x)])
ends up as
MyArray[MyOtherFunc(x])
and
MyFunc((SomeType)x)
ends up as
(SomeTypex)
Once you do a search to check what you get prior to doing a search and replace, make sure you keep modified files open in case you need to undo, and backup your source files before starting, this works well enough. Even with the pitfalls listed, still a huge time saver.