Posts Tagged ‘vs2005tips’
Multi-line Search and Replace in Visual Studio
Written by Patrick on January 14, 2008 – 8:54 pm -Often it is useful to do a global search and replace in a directory of files. For a search string on a single line this is trivial. Just hit Ctrl-Shift-H or “Edit -> Find and Replace -> Replace in Files”. Then enter the necessary information and do the replacement.
It becomes more tricky when you have a multiline search or replacement string. With the standard options in the search and replace box you can’t do this. But select Regular Expressions in the Find Options section and a multi-line string becomes possible.
Now you can use Regular Expressions in the search. Enter your search and replace string as normal but enter ‘\n’ where you want a newline to appear. Visual Studio can now find and replace multi-line strings!
Tags: Visual Studio, vs2005tips, vs2008tips
Posted in Visual Studio | 2 Comments »
