Find Replace
This feature is available in Q 4.9. From Q4.10, this feature is accessed from within Search.
Find and Replace allows the user to search for various text strings within all types of objects contained within Q, and apply replacements where appropriate. The Find and Replace dialog is accessible by pressing the button on the the top right of Q, or by selecting the menu Edit > Find...
The dialog comes in both Simple and Advanced modes. One can change between these modes by selecting Advanced > or < Simple as appropriate. Options selected in the Advanced mode are preserved in the Simple mode; they are just not displayed.
Simple Find and Replace
Find and Replace
Find what: This is the text to search for. One can use the wildcards: * (anything), # (single numeral) or ? (single letter). This is a drop-down menu and contains old search terms.
Wildcards allow you to create rules whereby you find and replace text even where there are not exact matches.
* | Matches anything. e.g. "Ages * and up" would match "Ages seven and up". |
# | Matches a single numeral (or the character #). e.g. "Q#" would match "Q7". |
? | Matches a single character. e.g. "Part ?" would match "Part A". |
Replace with: (Not available in Find.) When the search text is found, this text will be used to replace it. If you leave this empty, any text which matches the search text will be removed. This is a drop-down menu and contains old replace terms.
You can use the special text {CURRENT}
in Replace with to quote the original text that was found in the search. For example, to append "POST" to the end of a set of variable labels:
Find what: *
Replace with: {CURRENT}POST
Find In Options
Selection Restricts the search to only within selected items. (Important: The selection refers to whatever was selected when the dialog box was opened.)
Tables and Charts Search within the outputs of the project: the tables, charts and text items.
Variables and Questions Search within the variable and questions of the project.
Raw Data Search within the raw data searching each row of the data. Can be slow.
Data Importing Code Search within SQL or R code defining imported data.
Notes (Not available for Replace) Search within the Notes tab of a project.
Advanced Find and Replace
Find In Options
Selection Restricts the search to only within selected items. (Important: The selection refers to whatever was selected when the dialog box was opened.)
Tables and Charts A shortcut for checking/unchecking all the table and chart options.
- Title Try to match within table, chart, text item or group's title.
- Input questions/variables (Not available for Replace) Try to match within table or chart's input questions and variables, and their weights and filters). Use options under Variables and Questions if you would like to make replacements.
- Row and column labels (Not available for Replace) Try to match within a table's row and column labels.
- Text items Try to match within the text of text items.
- Notes Try to match within table or chart's associated notes.
- Code Try to match within the R source code of R Outputs.
Variables and Questions A shortcut for checking/unchecking all the variable and question options.
- Question names Try to match within question names.
- Variable names Try to match within variable names.
- Variable labels Try to match within variable labels.
- Variable comments Try to match within variable comments.
- Value attributes (non-Text only) Try to match within value attributes. Does not try to match Text responses.
- Expressions/Formulas Try to match within Excel, JavaScript or R variables.
Raw Data A shortcut for checking/unchecking all the raw data options.
- Text variables Try to match within individual cases of the raw data, restricted to the Text variables. This can be slow.
- Non-Text variables Try to match within individual cases of the raw data, restricted to the Non-Text variables. This can be slow.
Data Importing Code (Not available for Replace) Try to match within SQL or R code for imported data. This option is not available in older versions of Q.
Notes (Not available for Replace) Try to match within the Notes tab of a project.
Match:
Match: The type of match:
- All is a match which may be anywhere, and found as many times as it appears in the text.
- First is a match which may be anywhere but only the first match is found.
- Last is a match which may anywhere but only the last match is found.
- At start is a match which may only appear at the start of the text.
- At end is a match which may only appear at the end of the text.
For example, if looking for cola:
Type | Found | Not found |
---|---|---|
Anywhere | Diet cola is the best cola drink | I like fizzy drinks |
First | Diet cola is the best cola drink | I like fizzy drinks |
Last | Diet cola is the best cola drink | I like fizzy drinks |
At start | cola is a drink | Who likes cola? |
At end | My prefered cola | cola is a drink |
Restrictions:
Restrictions: Restrictions applied to the match:
- None means that there is no restriction placed on the match.
- Match entire cell contents means that the whole cell contents is used for the match (that is, there can be nothing left over from the search text).
- Whole word restricts the match to any text surrounded by whitespace.
For example, if looking for cola:
Type | Found | Not found |
---|---|---|
None | I like cola drinks | I like fizzy drinks |
Match entire cell contents | cola | I like cola drinks |
Match words | I like cola drinks | I like colatency |
Other Options
Match case If checked, case matters when determining a match.
Agree with case in replacement (Not available in Find, and only available in Replace if Match case is unchecked.) If checked, detects and copies the case of the text which is matched, to the replaced text. For example, if one searches for "drink it" and replaces with "consume it" with the Agree with case in replacement is checked, then:
- if the matched text is: "I like to drink it" the replacement is "I like to consume it"
- if the matched text is: "Drink it soon" the replacement is "Consume it soon"
- if the matched text is: "We Drink It All" the replacement is "We Consume It All"
- if the matched text is: "Please DRINK IT!" the replacement is "Please CONSUME IT!"
Ignore punctuation If checked, punctuation in the content being matched against is ignored. (However, punctuation in the search text is not ignored.)
Use wildcards If checked, you can use the wildcards: * (anything), # (single numeral) or ? (single letter) in your search text.
Spelling tolerant (Not available for Replace) If checked, matches will tolerate up to one spelling mistake when making a match.
Super-Advanced Find and Replace
Directly editing the project file
The Q Project File can be opened and edited in a text editor, such as NotePad (which is installed on all Windows computers). Thus, you can use the search and replace tools within the text editor to modify the Q project.
QScript
QScript can also be used to write scripts to perform advanced search and replace operations. For example, using string.replace(searchvalue,newvalue).