# 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>`&#x20;

| 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&#x26;token=919102a9-d9c9-4683-9b4a-3d330c8d35b1" alt=""><figcaption></figcaption></figure>

#### **Knowledge Bites:**&#x20;

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             |
