> For the complete documentation index, see [llms.txt](https://docs.avoautomation.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avoautomation.com/avo-assure/actions/generic/string-operations/replace.md).

# Replace

This is a pre-built Action located under the **@Generic Element**. The functionality of this Action in Avo Assure is to replace a specified part of the input text with a given replacement text. The updated result is stored in a dynamic variable.

## **Syntax**

**Input Value**: `<actual string>;<string to be replaced>;<string to replace>`

| Argument                                         | Description                                                            |
| ------------------------------------------------ | ---------------------------------------------------------------------- |
| <p>\<actual string></p><p>(Required)</p>         | Provide the actual string where the replacement should occur.          |
| <p>\<string to be replaced></p><p>(Required)</p> | Provide the string that needs to be replaced within the actual string. |
| <p>\<string to be replaced></p><p>(Required)</p> | Provide the new string that will replace the specified text.           |

**Output Value**: `<Dynamic Variable>;<Dynamic Variable>(Optional)`

| Argument                                     | Description                                                       |
| -------------------------------------------- | ----------------------------------------------------------------- |
| <p>\<Dynamic Variable ></p><p>(Required)</p> | This dynamic variable stores the replaced string.                 |
| <p>\<Dynamic Variable ></p><p>(Optional)</p> | This dynamic variable stores the status as **True** or **False**. |

### **Example:** Replacing a String with Another String

In this example, we explain how to replace a specific string with another string.

* **Action**: Replace
* **Input Value**: Michael Brown;Brown;Smith
  * The first argument (**Michael Brown**) specifies the original string.
  * The second argument (**Brown**) specifies the word to replace.
  * The third argument (**Smith**) specifies the new word that will replace the old one.
* **Output Value**: {Replaced value}
  * The updated string (Michael Smith) is stored in this **{Replaced value}** dynamic variable.
  * If the second output variable is defined, it stores the action status with the following possible values:
    * **True**: If the replacement is successful.
    * **False**: If the replacement fails due to invalid input or when the specified word to replace is not found.
* **Logical Explanation**: The **Replace** action fetches the value from the **Input Value** column (**Michael Brown;Brown;Smith**), replaces the string (Brown) with (Smith), and stores the updated string (Michael Smith) in the **{Replaced value}** dynamic variable.

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2Fb60iz79XKeWpJ9TlJ324%2Fimage.png?alt=media&amp;token=919102a9-d9c9-4683-9b4a-3d330c8d35b1" alt=""><figcaption></figcaption></figure>

#### **Knowledge Bites:**

Here are some examples of different string scenarios:

| String               | Input Value                | Result             |
| -------------------- | -------------------------- | ------------------ |
| Text Strings         | Blue World;World;Sky       | Blue Sky           |
| Numeric Strings      | 12345;23;98                | 19845              |
| Special Character    | <abc@domain.com>;abc;order | <order@domain.com> |
| Alphanumeric strings | ID8765;8765;2345           | ID2345             |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avoautomation.com/avo-assure/actions/generic/string-operations/replace.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
