Visual Studio Find & Replace Question??

  • Thread starter Thread starter Crash
  • Start date Start date
C

Crash

VS2005

In the find/replace dialog if I make a regex like this I can find all
of the "New" statements that instantiate a class with "System" in the
name:

<New>.*<System>

But how - in the VS find/replace dialog - can I negate the "System"
portion of the search? How do I say: find all lines with "New" that
do NOT have the word "System" after "New"??

Any help would be appreciated...
 
Crash said:
VS2005

In the find/replace dialog if I make a regex like this I can find all
of the "New" statements that instantiate a class with "System" in the
name:

<New>.*<System>

But how - in the VS find/replace dialog - can I negate the "System"
portion of the search? How do I say: find all lines with "New" that
do NOT have the word "System" after "New"??

Any help would be appreciated...

Try the following:

<New>:b+<~(System).*>

I replaced your .* between New> and <System so it only matches whitespace
(tabs and/or spaces) in between.....change it back if that's not what you
want :)

HTH,
Mythran
 
Crash said:
VS2005

In the find/replace dialog if I make a regex like this I can find all
of the "New" statements that instantiate a class with "System" in the
name:

<New>.*<System>

But how - in the VS find/replace dialog - can I negate the "System"
portion of the search? How do I say: find all lines with "New" that
do NOT have the word "System" after "New"??

Any help would be appreciated...

You can write a solution that does this as an add in to the VS IDE. When you
publish it, let me know.

It had better work. <smile>
 
Mythran said:
Try the following:

<New>:b+<~(System).*>

I replaced your .* between New> and <System so it only matches whitespace
(tabs and/or spaces) in between.....change it back if that's not what you
want :)

HTH,
Mythran

You can also replace the (System).* with (System).@ to get only the word
portion and not the entire string (IE:

Dim I As New IO.Stream

The first post I made would capture "New IO.Stream" while the new way I
posted would capture "New IO"

HTH,
Mythran
 
Back
Top