Special Characters

The following characters have a special meaning in the search query syntax, so they are treated as special characters in search terms. To use these characters as literal search characters, you need to escape them.

+ - && || ! ( ) { } [ ] ^ " ~ * ? : \ /

These characters are used to invoke search features such as required/prohibited terms (+ -), boolean operators (&& || !), grouping (( )), range search ([ ] { }), boost search (^), phrase search ("), fuzzy search (~), wildcard search (* ?), and field search (:).

For example, searching directly for a “/” or “:” in a URL or file path, or a “+” or “-” in program code, can produce unexpected search results. See below for how to escape these characters.

List of Special Characters

Special Character Meaning Related
+ - Specifies required or prohibited terms (AND search / NOT search) AND Search / NOT Search
&& || AND search / OR search AND Search / OR Search
! NOT search (exclusion search) NOT Search
( ) Groups search conditions Advanced Search
[ ] { } Range search ([ ] includes the boundary values, { } excludes them) Range-Specified Search
^ Boost search (weighting) Boost Search
" Phrase search (treats the enclosed text as a single phrase; can also be used instead of escaping) Advanced Search
~ Fuzzy search Fuzzy Search
* ? Wildcard search Wildcard Search
: Specifies the search field Field-Specified Search
\ Escape character (this page)
/ Slash (must be escaped when it appears in a URL, etc.) Field-Specified Search

Usage

To treat a special character as a literal search character, use one of the following methods.

  • Put \ immediately before the character to escape it. The single character that follows is treated as a normal character instead of query syntax.

  • Enclose the search term in ". The enclosed string is treated as a phrase search, and the special characters inside it are not interpreted as query syntax. Note, however, that because it becomes a phrase search, features such as wildcard search (* ?) are not available.

aaa\/bbb
"aaa/bbb"

For example, if you want to search for “C++” as a search term, escape it as follows.

C\+\+
"C++"