I need to do a find and replace, where I need to replace 2 lines at time. Does anyone know how to do this in the VS2008 IDE?
T开发者_开发百科o clarify, i want to replace 2 lines with 1 line.
Many thanks
Thanks to František Žiačik for the answer to this one.
To perform a find/replace, replacing multiple lines, you need to switch on regular expressions and use a line break (\n) between your lines, also using (:b*) at the start of each line to handle any tabs or spaces tabs.
So to find:
line one
line two
you would search for ":bline one\n:bline two" (without the quotes)
Try Multiline Search and Replace macro for Visual Studio.
You can activate the 'Use regular expressions' in the find dialog, and use \n
to match a newline.
In your case, type FirstLine\n:Zs*SecondLine
.
:Zs* skips leading blanks on line 2.
For example ,\n:Zs*c
matches a comma, newline, any number of blanks, a 'c'.
精彩评论