Sunday, January 15, 2012

[Quick VS Tip] Using regular expressions do the find/replace in Visual Studio

David Amador - Find/Replace in Visual Studio using regular expressions

Usually Find/Replace gets the job done for what I need, although sometimes using “Replace All” can break more stuff that it fixes.

But today I had this function I wanted to get rid of and simple change it with a public variable.
So I had something like this.
object->setLayer(/*BLABAL BLA CODE, */);

I want to replace it with something more simple
object->Z = /*BLABAL BLA CODE, */;

So using Visual Studio Find/Replace in regular expressions mode I used this as a search string
...

image..."
This is a find/replace tip that I want to keep handy and find in the future. Since I don't do this often, every time I do I have to relearn how to do it... With this, maybe the next time it won't take me as long... ;)

1 comment:

Virgil said...

Hi Greg, thanks for the useful posts but I have to say this blog looks bad - small fonts, bad layout. Hope this helps :)