delete empty lines in visual studio
programmers write a lot of text. better yet, they write structured text. that’s where regular expressions become handy. from time to time there are a lot of repetitive tasks, like deleting hundreds of empty lines out of an source file in VisualStudio 2005.
To get rid of them all press CTRL+H (the default hotkey) to fire up the search+replace dialog. In the find options select Use: Regular expressions as the search method. In the search textfield enter ^$\n and leave the replace with text field empty. Select the scope where search+replace should take place in the “Look in” drop down box. Now, fire away.

As a short hint as to what the expression actually means:
^ = match the beginning of an line
$ = match the end of a line, but not the linefeed character
\n = match the linefeed
About this entry
You’re currently reading “ delete empty lines in visual studio ,” an entry on coders
- Author:
- fschaper
- Published:
- 10.23.08 / 7pm
- Category:
- regular expressions, visual studio
- Feedback:


No comments
Jump to comment form | comments rss [?] | trackback uri [?]