How to remove extra blank lines in Visual Studio and keep only one blank line

1.Ctrl+H opens the replacement window ( pay attention to selecting the appropriate search range )

VS2010:

VS2017、VS2022:

2. Copy the following regular expression to the selection window above:

VS2010: ^(\s*)$\n\n

VS2017: ^(\s*)$\n\n

VS2022:^(\s*)$\n

3. Write all the following replacement windows \n

VS2010: \n

VS2017: \n

VS2022: \n

 

4. Click "Regular Expression"

VS2010:

VS2017:

VS2022:

5. Click Replace All

VS2010:

VS2017、VS2022:

Supplement the meaning of some symbols in regular expressions

\s represents any null character

\n represents the newline character of the butt. If it cannot be matched, please use "\n\r"

Guess you like

Origin blog.csdn.net/xijinno1/article/details/133364750