Finding a quoted string
I am trying to write a macro for Visual Studio that will search my source code and put a bookmark on all quoted strings that the first character is not an underscore (_).
I have written many macros but this one is giving me a problem, I cannot get it to escape the " in my search string. I can perform the search manually, but cannot get the macro to work. Any Ideas? I am sure it is just a matter of specifying the correct FindWhat string, but I have tried everything I can think of and nothing works.
Here is the macro -
Sub FindNonConformingStrings()
DTE.ExecuteCommand("Edit.Find")
DTE.Find.Target = vsFindTarget.vsFindTargetCurrentProject
DTE.Find.MatchCase =
TrueDTE.Find.MatchWholeWord =
TrueDTE.Find.MatchInHiddenText =
TrueDTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxRegExpr
DTE.Find.FilesOfType =
"*.cpp"DTE.Find.FindWhat =
"\"[!_]*\""DTE.Find.Action = vsFindAction.vsFindActionBookmarkAll
DTE.Find.Execute()
DTE.Windows.Item(Constants.vsWindowKindFindReplace).Close()
EndSub
