Syntax reference guide
Queries consist of space-separated search patterns that are matched against file contents. A file must have at least one match for each expression to be included. Queries can optionally contain search filters to further refine the search results.Keyword search (default)
Keyword search matches search patterns exactly in file contents. Wrapping search patterns in"" combines them as a single expression.
| Example | Explanation |
|---|---|
foo | Match files containing the keyword foo |
foo bar | Match files containing both foo and bar |
"foo bar" | Match files containing the phrase foo bar |
"foo \"bar\"" | Match files containing foo "bar" exactly (escaped quotes) |
Regex search
Toggle the regex button (.*) in the search bar to interpret search patterns as regular expressions.
| Example | Explanation |
|---|---|
foo | Match files with regex /foo/ |
foo.*bar | Match files with regex /foo.*bar/ (foo followed by any characters, then bar) |
^function\s+\w+ | Match files with regex /^function\s+\w+/ (function at start of line, followed by whitespace and word characters) |
"foo bar" | Match files with regex /foo bar/. Quotes are not matched. |
Search filters
Search queries (keyword or regex) can include multiple search filters to further refine the search results. Some filters can be negated using the- prefix.
| Prefix | Description | Example |
|---|---|---|
file: | Filter results from filepaths that match the regex. By default all files are searched. | file:README - Filter results to filepaths that match regex /README/file:"my file" - Filter results to filepaths that match regex /my file/-file:test\.ts$ - Ignore results from filepaths match regex /test\.ts$/ |
repo: | Filter results from repos that match the regex. By default all repos are searched. | repo:linux - Filter results to repos that match regex /linux/-repo:^web/.* - Ignore results from repos that match regex /^web\/.*/ |
rev: | Filter results from a specific branch or tag. By default only the default branch is searched. | rev:beta - Filter results to branches that match regex /beta/ |
lang: | Filter results by language (as defined by linguist). By default all languages are searched. | lang:TypeScript - Filter results to TypeScript files-lang:YAML - Ignore results from YAML files |
sym: | Match symbol definitions created by universal ctags at index time. | sym:\bmain\b - Filter results to symbols that match regex /\bmain\b/ |
context: | Filter results to a predefined search context. | context:web - Filter results to the web context-context:pipelines - Ignore results from the pipelines context |
Boolean operators & grouping
By default, space-separated expressions are and’d together. Using theor keyword as well as parentheses () can be used to create more complex boolean logic. Parentheses can be negated using the - prefix.
| Example | Explanation |
|---|---|
foo or bar | Match files containing foo or bar |
foo (bar or baz) | Match files containing foo and either bar or baz. |
-(foo) bar | Match files containing bar and not foo. |

