Find/Replace in Visual Studio with Regular Expressions and Variables
This can be a major time saver when you want to find some text and perhaps duplicate it or manipulate it throughout a bunch of files in your project.
In my case, I was asked to take all the AlternateText properties on Image controls, and duplicate them to ToolTip attributes. There are ways to accomplish this without actually changing the markup at all, but I wanted to see if Visual Studio could do it for me, and my good friend and colleague, Alex Cibotari, cooked up a solution.
Find: AlternateText='{[^']+}'
Replace With: AlternateText='\1' ToolTip='\1'
You can see that the \1 serves as a variable placeholder for the contents of the first regular expression block in the Find field.
I haven't had the chance to try this out with multiple variables yet, but it makes sense that it would work.
How awesome is that? Thanks, Alex!
There are lots of other ways this can be used - let me know if you come up with any cool ones.