问题
Really loving the 'new' code search feature of TFS, but I am unable to guess how to escape "
an .
.
I want to find places in my code where I am using "SOMESTRING." in my code, but when searching for this the search engine seems to strib "
and .
so that I get all results where SOMESTRING
is used and that particular string that is a lot of results.
I have tried with backslash eg. \"SOMESTRING.\"
but same thing happens. ´strlit:SOMESTRING.` insures that I only get string literals in the results but the ´.´ is still ignored. The help don't seem to cover this.
回答1:
Checked for some characters in code search.
You can't use the symbol characters except *
and ?
as part of your search query, which including below characters: . , : ; / \ ` ' " = ! # $ & + ^ | ~ < > ( ) { } [ ]. The search will simply ignore these symbols.
But you can use wildcard characters *
and ?
to broaden your search.
You can use wildcard characters anywhere in your search string except as a prefix in a simple search string or a query that uses a code type filter. For example, you cannot use a search query such as *RequestHandler or class:?RequestHandler. However, you can use prefix wildcards with the other search filter functions; for example, the search query strings file:*RequestHandler.cs and repo:?Handlers are valid.
Please see Broaden your search with wildcards for details.
If you want to search the strings including these symbol exactly, you can first search it in code search, the copy the specific code to text editor (eg, Notepad++), then search stings with the symbol characters.
来源:https://stackoverflow.com/questions/44589517/how-to-escape-search-strings-in-tfs-code-search