search for one value within so many characters of another value - within my source code

In my Visual Studio 2010 Pro dev environment, I want to search for the following two phrases (excluding the quotes, mind you):




once the search engine locates the "href=" I want it to begin searching after this phrase up to say, 50 characters, for the phrase "Eval(".

Is this only to be accomplished through a RegEx type search?

What would be the syntax?  Don't know RegEx very well.
Tom KnowltonWeb developerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Can you explain a bit more on what you are trying to accomplish? i.e. why a regex to search in VS?
Tom KnowltonWeb developerAuthor Commented:
It was so I could find examples like THIS in my source code:

  <a id="linkViewDocument" runat="server" href='<%# "~/ViewDoc.Aspx?DocID=" + Eval("BidDocID") + "-" + Eval("BidDocSID") %>'>View Document</a>

Open in new window


You might recognize this from another question of mine you just answered.  : )

I would still like to know how to find snippets like this, which have an href and then later on have an EVAL...
Try something like this:

Open in new window

FYI: Try tool like Expresso for creating/testing regexs..

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

Tom KnowltonWeb developerAuthor Commented:

I'll have to back-burner this for a few hours.

But I will return and give more feedback.

I am sure your RegEx is fine or can be made the points are yours.  I won't make you wait for me.

Tom KnowltonWeb developerAuthor Commented:


Did not seem to work.
Tom KnowltonWeb developerAuthor Commented:
Well, I take it back.

I downloaded and installed Expresso, and your original Reg Ex worked fine:

expresso test

For some reason it will not work in VS search using RegEx.
Hmmm interesting... I did try it in VS before posting it and it did search the href Eval string that you had in the other post.
Can you post the string you have in your source...
Also make sure you have Regex selected while searching
Tom KnowltonWeb developerAuthor Commented:

Notice above in the screenshot I have "Use Regular Expressions" selected via the GUI.


should find this line, correct?  (see below)

<%@ Register TagPrefix="uc2" TagName="BigLabel" Src="~/Controls/BigLabel.ascx" %>
I tested in VS2012...and Register.{0,50}Tag.* works as well.
Not sure may be it's the VS version..Let me see
vs regex search
I think it's the issue with the VS you are using. It has is some of the other interpretations.

It is not liking the {0,50}
Check this:

This will work: .*Register.*Tag.*
Tom KnowltonWeb developerAuthor Commented:

this worked.  Thank you!

but this does not allow me to specify "match if found within XX characters" correct?
Nope....that's the limitation with the VS version you are using
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.