Escaping special characters

Special characters can serve different functions in the query syntax.

To search for a special character that has a special function in the query syntax, you must escape the special character by adding a backslash before it, for example:

  • To search for the string “where?”, escape the question mark as follows: “where\?”
  • To search for the string “c:\temp,” escape the colon and backslash as follows: “c\:\\temp”

Not escaping such special characters can result in syntax errors.

Special characterNotes on behavior when not escaped
Ampersand (&) 
Asterisk (*)Used as a wildcard character.
At sign (@)A syntax error is generated when an at sign is the first character of a query. In xmlxp expressions, the at sign is used to refer to an attribute.
Brackets [ ]Used in xmlxp expressions to search the contents of elements and attributes.
Braces { }Generates a syntax error.
Backslash (\) 
Caret (^)Used for weighting (boosting) terms.
Colon (:)Used to search in the contents of fields.
Equal sign (=)Generates a syntax error.
Exclamation point (!)A syntax error is returned when an exclamation point is the first character of a query.
Forward slash (/)In xmlxp expressions, a forward slash is used as an element path separator.
Greater than symbol (>) Less than symbol (<)Used in xmlxp expressions to compare the value of an attribute. Otherwise, these characters generate syntax errors.
Minus sign (-)When a minus sign is the first character of a term, only documents that do not contain the term are returned.
Parentheses ( )Used for grouping.
Percent sign (%)Specifies that a search term is optional.
Plus sign (+) 
Question mark (?)Handled as a wildcard character.
Semicolon (;) 
Single quotation mark (‘)Single quotation marks are used to contain xmlxp expressions.
Tilde (~)Handled as proximity and fuzzy search operators.
Vertical bar (|) 

Escaping special characters that do not serve a special function in the query syntax is optional. The following table shows some examples of special characters that do not require escaping.

Special characterNotes
Comma (,) 
Dollar sign ($) 
Period (.)In xmlxp expressions, a period is used to search the content of elements.
Pound sign (#) 
Underscore (_)