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?
To clarify, i want to replace 2 lines with 1 line.
Many thanks
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?
To clarify, i want to replace 2 lines with 1 line.
Many thanks
The Find and Replace dialog allows the use of regular expressions. Try tossing a \n in the find string for the newline with the regular expressions option turned on.
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'.
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 ":b*line one\n:b*line two" (without the quotes)
You can replace multiple lines with PilotEdit Lite. It is free. http://www.pilotedit.com