Tuesday, May 19, 2009

Using the Visual Studio Editor Regular Expression Search/Replace

I always forget this so I'm saving it here

If you want to save a string and then use it in the replace box put a {} around it.  Then you can refer to it using \1 or \2 (depending on how many curly brackets you put.

Ok, if you want more info you can check out the three part tutorial.

http://blogs.msdn.com/vseditor/archive/2004/06/16/157276.aspx
http://blogs.msdn.com/vseditor/archive/2004/06/18/159515.aspx
http://blogs.msdn.com/vseditor/archive/2004/06/18/159515.aspx

Or this site which compares it to regular regex.
http://www.codinghorror.com/blog/archives/000633.html

No comments: