2

I was trying to search for ".IsSet", but not "DocumentState.IsSet", in VS 2008 using regular expression search. How do I compose the regular expression?

Thanks!

2
  • Are you saying that you want to search for every *\.IsSet except for when it begins with "DocumentState"? I think that is somewhat advanced... Commented Aug 4, 2009 at 18:17
  • Right, I'm searching for not begin with "DocumentState" Commented Aug 4, 2009 at 18:35

4 Answers 4

2

Try

(?!<DocumentState)\.IsSet

The ?!< is a "negative lookbehind".

Sign up to request clarification or add additional context in comments.

Comments

1
~(DocumentState)\.IsSet

will match all .IsSet instances that do not follow DocumentState. To match exactly .IsSet but not .IsSetFoo, you can either use

~(DocumentState)\.IsSet>

or check the Match whole word option.

See Regular Expressions (Visual Studio) for a list of regular expression tokens supported in the Visual Studio search.

Comments

0

Try this :

^\.IsSet  

^ : means beginning of the string.

Comments

0

I don't know if you can with the VS Search, but you can

  1. Replace DocumentState.IsSet by a token (like "DOCSTATE")
  2. Replace all .IsSert
  3. Replace your token "DOCSTATE" with DocumentState.IsSet

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.