How to replace multiple lines in Visual Studio 2008

I need to find and replace where I need to replace 2 lines in 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

+4
source share
3 answers

Thanks to Frantisek Žiačik for answering this question.

To search / replace by replacing multiple lines, you need to include regular expressions and use line breaks (\ n) between your lines, and use (: b *) at the beginning of each line to handle any tabs or spaces.

So, to find:

line one line two 

you would be looking for " : bline one \ n: bline two " (without quotes)

+6
source

Try Multiline Macro Search and Replace for Visual Studio.

+3
source

You can activate Use Regular Expressions in the search dialog and use \n to match a new line. In your case, enter FirstLine\n:Zs*SecondLine .

: Zs * skips leading spaces in line 2.

For example ,\n:Zs*c matches a comma, a new line, the number of spaces, 'c'.

0
source

Source: https://habr.com/ru/post/1313884/


All Articles