$ cat "

Removing Regions in Visual Studio

"

Some people are truly in love with the whole #region thing in Visual Studio. Personally I can't say I share that sentiment. Because of this I found myself wanting to quickly remove all regions in a solution. The first solution that came to mind was our old friend the regular expression.

To remove all regions, open the Find & replace dialog (Ctrl-H), choose the appropriate scope (current document, entire solution etc) and click the "Use regular expressions" checkbox. Enter the following regular expression in the Find field:

\#(end)*region.*$

Make sure the Replace field is empty, and hit the Replace All button. Tada!

Written by Erik Öjebo 2010-08-27 15:09

    Comments