Skip to main content

Search for and replace text using the Answer Utility block

Overview

The Search & Replace action does exactly what its name suggests; it searches a body of text for a specific item, such as a term or a phrase, and replaces it with new text! Setup is quick and easy. You can define a static bit of text or use a variable to allow for text that can be updated depending on the scenario.

s_r_video.gif

Configure the Search & Replace action

To configure the Search & Replace action, you need to provide the body of content that contains the text that is to be updated, the text to be updated, and optionally the replacement text for the text that is to be updated.

There are two mandatory fields to complete, plus one optional field.

Input Text

The content to search within for the specified Search Text.

Search Text

The text to search for within the Input Text.

Replacement Text (optional)

The text that replaces the Search Text within the Input Text.

Note

Omit this option if you wish to remove the Search Text from the Input Text.

Setup steps

  1. Drag the Answer Utilities Block from the block drawer and drop it into the Answer workspace.

  2. Click the Select an action drop-down and select Search & Replace. The block updates with new fields relevant to this utility.

  3. Add a variable to the Input Text field containing the content to search within.

  4. Add the search term or phrase you wish to search for to the Search Text field. Use a variable to allow for updating the search text dynamically.

  5. [Optional] Click the Select Optional Inputs drop-down, then select Replacement Text.

  6. [Optional] Update the Replacement Text field with the content that is to replace the Search Text.

  7. Click the Select Optional Variables drop-down menu, then select Formatted Text.

  8. Select an existing variable for saving the updated Input Text, or create a new variable.

  9. Click the Fallback Answer drop-down menu, then select a fallback Answer to surface should an error occur.

  10. Click Save.

    search_replace_block.png

Have any questions? Contact your Ada team—or email us at help@ada.support.