Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to escape search strings in TFS Code Search

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.

like image 623
Tore Østergaard Avatar asked Jun 16 '17 12:06

Tore Østergaard


People also ask

How do I find my TFS code?

TFS: https://<server>:<port>/tfs/<team project collection>/_search? type=Work%20item&lp=apps-account&text=%s&_a=research. In the browser bar, type tfsw and then space bar and search for something like test. As you can see, this then obviously searches your code.

How do I search Azure Devops?

Go to your organization, and then enter the project name in the Filter projects box. Go to Repos > Files, highlight your file, and then select History. When you search from the Organization settings page, your search results include both organization-level and project-level settings.


1 Answers

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.

like image 91
Andy Li-MSFT Avatar answered Oct 04 '22 03:10

Andy Li-MSFT