Special characters and operators
This topic explains the special characters and operators you can use when you are creating a Text Search query in NVivo—for example, if you want to search for all references to a particular person, you could use the OR operator to search for 'John Smith OR JS'.
What do you want to do?
- Use wildcard characters
- Combine multiple words and phrases using Boolean operators
- Find words with similar spelling using a fuzzy search
- Specify proximity using near search characters
- Other special characters
Use wildcard characters
Wildcard characters are often used in place of one or more characters when you do not know what the real character is or you do not want to type the entire name.
Wildcards cannot be used as the first character of a search and they can only be used in single terms (not phrases).
You can use the following wildcards:
-
Asterisk (*) as a substitute for zero or more characters. For example—g*t will find get, great and gt
-
Question mark (?) as a substitute for a single character. For example—g?t will find get and got but not great or grunt
Combine multiple words and phrases using Boolean operators
When running a Text Search query, you can use the following Boolean characters:
Operator | Description | Syntax | Example |
OR |
Searches for items containing either (or both) of two terms. When you enter multiple words or phrases without an operator, the OR is implied. |
A OR B
|
|
AND |
Searches for items containing both terms. |
A AND B |
|
NOT (-) Prohibit |
Searches for items containing the first term but not the second term. Cannot be used with a single term. |
A NOT B
|
|
+ (required) | Searches for items containing the required term and optionally the second term. |
+A B |
Find words with similar spelling using a fuzzy search
To find words that differ by one character (added, removed or substituted) from the search term—enter a tilde (~) character after a word. For example:
-
'color~' will find 'colors' or 'colour'
-
'analyze~' will find 'analyzes' or 'analyse'
Specify proximity using near search characters
Finds words that are within a specified word distance from each other—the tilde (~) specifies proximity.
For example, “happy busy”~10
Searches for the existence of the words happy and busy within 10 words of each other.
Other special characters
You can use the following characters to refine the criteria of a Text Search query:
Character |
Name | Use |
+ |
Plus
|
Indicate words or phrases that must be included |
- |
Hyphen |
Can be used in place of NOT |
&& |
Ampersand |
Can be used in place of AND |
| |
Pipe |
Can be used in place of OR |
! |
Exclamation mark |
Can be used in place of NOT |
( ) |
Round brackets |
Groups clauses to form sub queries |
" " |
Double quotes |
Enclose a group of words to enable search for a phrase |
~ |
Tilde |
Indicate proximity |
* |
Asterisk |
Multiple character wildcard to include any number of characters |
? |
Question mark |
Single character wild card to include only one character |