Expert Search with Regular Expressions (regex)
GREP is a well-known search tool in the UNIX world. The original GREP tool printed each line containing the search pattern, hence the acronym GREP (Globally search for a Regular Expression and Print matching lines).
In ATLAS.ti, the results of a GREP search are not printed line-by-line; rather, the text matching the search pattern is highlighted on the screen, or you can automatically code the results including some surrounding context.
The core of a GREP search is the inclusion of special characters in the search string that control the matching process. GREP finds instances in your data that match certain patterns.
You can test and debug any regular expression you formulate on this website: https://regex101.com/
Carrying out a text search with Regex
To open the tool, select the Search & Code tab and from there Expert Search.
Select documents or document groups that you want to search and click Continue.
Select the base unit for the search and the coding:
- Exact matches
Enter a search term. You can test your search expression in the text that you see in the lower half of the screen.
To run the search, click on Show Results.
The result page shows you a Quotation Reader, indicating where the quotations are when (auto)coding the data. If codings already exist at the quotation, those will also be shown.
By clicking on the eye icon, you can change between small, medium and large previews.
You can autocode all results with one code by highlighting all data segments, e.g. via Ctrl+A. Then select Apply Codes, enter a code name and click the plus icon. Depending on the area you have selected, either the exact match, the word, the sentence or the paragraph is coded.
Another options is to review each find and code it by clicking on the coding icon. This opens the regular Coding Dialogue.
|Matches an empty string at the beginning of a line.|
|Matches an empty string at the end of a line.|
|Matches any character except a new line.|
|Matches at least one occurrence of the preceding expression or character.|
|Matches the preceding element zero or more times. For example, |
|Matches the preceding element zero or one time. For example, |
|Matches a range or set of characters: |
|Matches an empty string at a word boundary|
|Matches an empty string not a word boundary|
|Matches an empty string at the beginning of a word|
|Matches an empty string at the end of a word|
Enclose ORed expressions with parentheses if OR should be restricted to certain sequences of characters or expressions. See example below
Backspace character disables the special GREP functionality of the following character:
|Matches any digit (equivalent to |
|Matches anything but a digit|
|Matches a white-space character|
|Matches anything but a white-space character|
|Matches any word constituent character|
|any character but a word constituent|
|Any alphanumeric, i.e., a word constituent, character|
|Any alphabetic character|
|Any control character. In this version, it means any character whose ASCII code is < 32.|
|Any decimal digit|
|Any graphical character. In this version, this mean any character with the code >= 32.|
|Any lowercase character|
|Any punctuation character|
|Any white-space character|
|Any uppercase character|
|Any hexadecimal character|
Note that these elements are components of the character classes, i.e. they have to be enclosed in an extra set of square brackets to form a valid regular expression. A non-empty string of digits or arbitrary length would be represented as
Examples of GREP Searches
In the following, a few search examples are presented showing the matching GREP expression in the column on the right.
man|womanmatches "man" and "woman." You could also use
(|wo)manto the same effect.
H(a|e)llomatches "Hello" and "Hallo."
H(a|e)+llomatches "Haaaaaallo" as well as "Heeeeeaaaaeaeaeaeaello."
And how about
the (angry|lazy|stupid) (man|woman) (walk|run|play|fight)ing with the gr(a|e)y dog- get the idea?