I’m trying to do something that I believe is easy but I couldn’t figure it out. I’m simply trying to find a section of code and replace it. I have a method in several files
[TestMethod, ExpectedException(typeof (InvalidOperationException))]
public void RetrieveWithInvalidKey()
And I’m trying to replace it with:
[TestMethod]
public void RetrieveWithInvalidKey()
I can’t just find [TestMethod, ExpectedException(typeof (InvalidOperationException))] because there are many others that I do not want to change. I only want to change the ones with the public void RetrieveWithInvalidKey() afterwards. I tried to find [TestMethod, ExpectedException(typeof (InvalidOperationException))]\npublic void RetrieveWithInvalidKey() using regular expressions but it didn’t find it.
How do I find this specific block of code for replacing? I also have ReSharper if that can do it but it didn’t recognize a method pattern.
When using regex in find box, you must escape the ‘[‘, ‘]’, ‘(‘, and ‘)’ characters with a backslash.
Thus you should use:
for your search.
Type in the following in the replace box:
That should get you what you want.