views:

720

answers:

3

I have a get method in my code which is currently taking a parameter. I want to remove this parameter from this method. For this I have to update all those pieces of code where this method is used. I tried find and replace in VS2008 with the wildcard option as get(?*) to get(). But unfortunately this is matching for if(get() > 1) type of strings as well. What other string I can use to do this. I hope my requirement is clear. Basically I want to replace all get(blah) with get(). How can I do this?

+1  A: 

Use the Refactor functionality of Visual Studio.

Gerrie Schenck
+1  A: 

To expand upon @Gerrie Schenck's answer, go to the get(blah) method definition(s). Click on the definition and choose remove parameter. Remove the parameter(s) that you don't need. It should go through the code and update any references that use the method and delete the corresponding arguments.

If you've already updated your method and can no longer use this functionality, you might try using get\([^)]+\). I don't have my Regex cheat sheet handy but that should match get(, followed by one or more things that are not a closing paren, and finally a closing paren. You might need to escape the closing paren inside the brackets, too.

tvanfosson
did not see your answer, which is better. +1 to you and mine can go to /dev/null
Learning
+1  A: 

Searching for

get([!)]*)

kern