Search and replace option in Bot editor

The search and replace feature enables you to search for any text or string and variable within an action in the Bot editor, and replace it with text or string and variables of the same type. This feature helps in bulk replacement within the bot.

Use one of the following methods to access Search and replace:
  • Click Assistant > Search and replace option.
  • Click the Search in this bot icon and click the Open search and replace icon.
  • Use Ctrl + H shortcut key.
The Search and replace feature comprises of four components:

Search type

Click the Search type drop-down menu to select one of the following:
  • String: To search for text or string.
  • Variable name: To search for a variable.
Figure 1. Search type
Search and replace feature

Search

In the Search field, enter the term or keyword you want to search. You can search for a text value, variable name, or long text that has multiple matches.

Replace

In the Replace field, enter the term or keyword that you want to replace.
  • If the Search type field is String, then enter the text or string in the Replace field to replace it.
  • If the Search type field is Variable name, then select the variable from the Replace field.
Note: If the search type is a variable, then the Search and Replace drop-down menus will only display the variable names that are used in the bot.
Points to remember:
  • Ensure that you enter different values or select different variables in Search and Replace fields.
  • Search field is case-sensitive.
  • When you set the Search type to Variable, the Search is applicable only for the used variables.
  • Any search text that you have used in the Search field of the Advanced search window is retained in the Search field of the Search and replace tab.

    For example, if you have used the keyword 'commands' in the Search field and then open the Advanced search window, the keyword 'commands' is retained in the Search field of the Advanced search window.

  • You can only use the Search type > String to search a string value. Although you can search and replace the variable types such as number, boolean or datetime, you cannot search or replace their values.

Results

The Results header displays the total count of matched action names and the count of selected actions or line item in a bot. For each action name listed, the line number containing the action and the total matching results found within the action details are displayed as Action or Trigger | Line number | Number of matches.

You can select one, or all line items where the search keyword appears for replacement. When you click the Replace button, all the selected line items are replaced. automatically

Consider the following example when you select the Search type as String. Enter Please enter your commands to loop in the Search field and Please do not edit this in the Replace field. Select the Comment check box for items you want to replace, and click Replace button at the bottom.

Figure 2. Results for Search type: String
Search and replace feature

Similarly, here is a sample scenario where you want to search and replace a loop counter variable. You select the Search type as Variable-name. Use the Search drop-down menu to select Loop-Counter-2, click Replace drop-down menu and select Loop-Counter. In the Results tab, select the line item where you want to replace the loop counter and click the Replace button at the bottom.

Figure 3. Results for Search type: Variable-name
Search and replace feature
Points to remember:
  • The Results tab displays the total count of search terms present in a bot, along with the corresponding line number in the action. However, only the count of matching line items (or actions) within the bot are displayed.

    Each line item can have multiple matches and is not counted in the total matching line items. For individual line items, the count of multiple matches is displayed within the particular line item in the Results tab.

  • The Replace button is enabled when you select one of the line items in the Results tab.
  • Click the line item to get more details from the action. If there are multiple matches for the same line item in the detailed view, they are all displayed and you can select the specific match to replace them.
  • The Next and Previous arrows at the bottom of the dialog allows you to navigate to the next and previous items in the search list.