Using Regular Expressions in VisualStudio.Net Find Dialog

I’m a late comer to regular expressions so it’s still awfully painful, albeit marvelously useful, to have twist my brain into regex mode. I’ve wanted to make use of regular expression in the Visual Studio.Net find dialog, and today buckled myself in and gave it a whirl. Altogether too much later here’s what I have to show. (Please don’t tell any of the kind folks I owe work.)

In any case, I had a CSS file that needed cleaning up. It had a lot of old choices commented in blocks, which is what I do when I’m foolin…er…experimenting with different choices. I thought it would be splendid if I could use a regular expression to search for all the comment blocks that looked like this:

/* color: #555753; */

The regex I used for finding all the instances text between the comment block delimiters is in the linked screen shot[1].Simple RegEx example for VisualStudio.Net find dialog

Sadly, I couldn’t find an expression the VS IDE was happy with for finding comments with 0..n lines. For example,

/* The following doesn't work in IE
	border-right: 1pt solid;
	border-top: 1pt solid;
	border-left: 1pt solid;
	border-bottom: 1pt solid;
	background-color: transparent;

All my attempts to craft an expression ran headlong into the message “Evaluation stack overflow: the pattern may be too complex.” Not surprisingly, the advice in the help is to simplify the expression. Not terribly helpful. Perhaps the problem is my unfamiliarity with the syntax; however, it seems to me that regular expressions in the 2003 VS IDE weren’t as fully realized as would be helpful.

[1]WordPress is wonderful and I’m grateful that it’s free, but it’s not code friendly. Understandably so.


2 thoughts on “Using Regular Expressions in VisualStudio.Net Find Dialog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s