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:

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

    ReplyDelete

NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...

ALL comments are moderated. I will review every comment before it will appear on the blog.

Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...

I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...

Please see my comment policy for more information if you are interested.

Thanks,
Greg

PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...