October 2015

You are browsing the site archives for October 2015.

The search result window from Visual Studio is not really the best. Sometimes it can be hard to find what you’re searching for, especially when you have long file paths. Unfortunately you cannot even copy/past the results to Excel and filter/sort there.

Luckily there is a hidden Registry Key you can use to format the output on your own.

The Registry Key is in  HKCU\Software\Microsoft\VisualStudio\<your VS Version>\Find and should be named Find result format (type is string). Just create it if it doesn’t exist.

It holds a formatting string and you can use a combination of the following variables:

Value Explanation Example
 $p Path
 $f Filename
 $v drive / unc share
 $d Directory
 $n Name
 $e Extension
 $l Line
 $c Column
 $x end col if on first line, else end of first line
$L span end line
$C span end col
$0 Matched text
$t text of first line
$s summary of hit
$T Test of spanned lines
\n Newline
\s Space
\t Tab
\\ Slash
\$ $

My favorite is $p($l,$c):\t\t\t$s\r\n This one allows you to copy/paste the result to Excel for very easy further filtering and sorting (columns are detected correctly because of the tabs).

Another nice one is $f$e($l,$c):$t\r\n which just shows the file names and not the entire paths.

Sources: