Replace Dialog

Applies to TestComplete 15.47, last modified on January 20, 2023

Use the Replace dialog to search for and replace data in your tests. To call the dialog:

  • Select Edit > Replace from the main menu of TestComplete.

– or –

Replace Dialog

In the Find what box, enter the text to be found and replaced. You can either type the needed text or select it from the list of phrases you searched for earlier. The Find what box may include wildcards (* or ?) or regular expressions. Using regular expressions, you can search for multiline text (see below).

In the Replace with box, enter the replacement text or select it from the list of strings you entered earlier.

In the Look in list, specify where TestComplete will search for the text. The possible values are:

Value Description
Current Document or Panel TestComplete will search for the specified item in the active editor.
Project Suite TestComplete will search for the specified text in all project items of all projects of your project suite.
Open Documents TestComplete will search for the specified text in all editors opened in the Workspace.
Selection in Current Document or Panel TestComplete will search for text in the selected block in the currently active editor.
In the Keyword Test editor, the dialog can find and replace text only in the Value column. You cannot use the dialog to find and replace operations in keyword tests.

Use the following options to set additional search conditions:

Option Description
Match case Specifies whether the search is case-sensitive.
Match whole word TestComplete will search for text that matches the sought-for string as a whole word, not part of a word.
Search in collapsed sections (Available only if you search for text in script code.) Specifies whether TestComplete will search within collapsed code blocks.
Search up TestComplete will start the search from the current cursor position or from the currently active panel and will go upwards.
Use Specifies how TestComplete will treat the sought-for string: as a regular expression or as a string with wildcards.
Wildcards
TestComplete supports two standard wildcards: asterisk (*) and question mark (?). The asterisk corresponds to the string of any length, the question mark - to any single character.
Regular expressions
Regular expression includes a lot of tokens and modifiers that let you specify complex search patterns. Using regular expressions you can search for text that reside on several text lines. To specify the newline symbols, use the \r\n modifier. For instance, if you type ;\r\n\end in the Find what box, TestComplete will search for a text fragment that includes a semicolon at the end of a line and the word "end" at the beginning of the next line.

For complete information on supported regular expressions, see Regular Expressions Syntax.

Tip: You can use sub-expressions to replace only a part of the sought-for expression.

Example

To search for the first occurrence of the needed text, click Find Next. TestComplete will highlight the found text.

To replace the highlighted text, click Replace. TestComplete will replace the text and then will find the next occurrence.

To search for the next occurrence of the text without replacing the highlighted text, click Find Next again.

To find and replace all the occurrences on the needed text, click Replace All. TestComplete will replace all found occurrences of the text with the needed text and show the Search/Replace Results panel that lists all replacements made. In the panel, you can undo a replacement, if necessary.

TestComplete will also highlight all script lines and keyword test operation parameters containing the replaced text with the icon in the gutter.

To close the dialog, click Cancel.

See Also

Finding and Replacing
Search/Replace Results Panel
Regular Expressions Syntax

Highlight search results