spacer
Addins

Regular Expression Visualizers

by admin on March 1, 2008

Roy Osherove has released a very handy set of Regular Expression Visualizers for Visual Studio 2005.

Visualizers are one of the most helpful additions to debugging in Visual Studio 2005. Visualizers allow you to create your own customized display for any data type.  You’re able to tweak or completely rework how a data type is displayed.  Think back to how difficult it is to dig through a DataSet in Visual Studio 2003, then compare that to the easy navigation of DataSet objets in Visual Studio 2005.  Behold the Power Of Visualizers!

Roy Osherove has released a very handy set of Regular Expression Visualizers for Visual Studio 2005.  Installation, as with all custom Visualizers, is simply a matter of adding the files to your VS 2005’s profile folder, normally located in your home directory under “My Documents\Visual Studio 2005\Visualizers”.

Restart Visual Studio, then create a pattern in a snippet and test out the visualizer.  Straight from Roy’s example:

string pattern ="(aa|bb)";

Regex r = new Regex(pattern);

MatchCollection m = r.Matches(pattern);

Console.WriteLine(m); // BREAK HERE!

Run this in a debugger session, breaking on the Console.WriteLine statement.  You’re now able to select the MatchCollection variable ‘m’ with Osherove’s handy Visualizer as shown below.

spacer

The next image shows how this simplistic pattern measures up as displayed in the “Matches” tab.

spacer

The “Pattern Desc.” tab shows an English version of what the RegEx in question captures.  (Microsoft’s Eric Gunnerson wrote the descriptive text.)

spacer

blog comments powered by Disqus

Previous post: CoolCommands

Next post: ImportSorter

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.