> For the complete documentation index, see [llms.txt](https://docs.frends.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.frends.com/tasks/tasks/regex/replace.md).

# Replace

Task version: 1.2.0

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.Regex/tree/main/Frends.Regex.Replace>

## Task Parameters

{% tabs %}
{% tab title="Input" %}

| Name                         | Description                                                                                               |
| ---------------------------- | --------------------------------------------------------------------------------------------------------- |
| InputText : `String`         | <p>Text to be modified.</p><p><br>Default: <code>-</code><br>Example: <code>Example text.</code></p>      |
| RegularExpression : `String` | <p>Regular expression pattern.</p><p><br>Default: <code>-</code><br>Example: <code>abc\*</code></p>       |
| Replacement : `String`       | <p>Text to replace regex matches with.</p><p><br>Default: <code>-</code><br>Example: <code>foo</code></p> |
| {% endtab %}                 |                                                                                                           |

{% tab title="Options" %}

| Name                             | Description                                                                                                                                                                                                                                   |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ThrowErrorOnFailure : `Boolean`  | <p>Whether to throw an exception on failure.</p><p>When false, errors are returned in the Result object instead.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                       |
| ErrorMessageOnFailure : `String` | <p>Custom error message used when ThrowErrorOnFailure is enabled or an error result is returned.</p><p>Leave empty to use the original exception message.</p><p><br>Default: <code>-</code><br>Example: <code>Regex replace failed</code></p> |
| {% endtab %}                     |                                                                                                                                                                                                                                               |
| {% endtabs %}                    |                                                                                                                                                                                                                                               |

## Task Result

| Name                    | Description                                                                              |
| ----------------------- | ---------------------------------------------------------------------------------------- |
| Success : `Boolean`     | <p>Indicates whether the task completed successfully.<br>Example: <code>true</code></p>  |
| ReplacedText : `String` | <p>Contains Regex-replaced input.<br>Example: <code>Replaced text.</code></p>            |
| Error : `Error`         | <p>Error information, populated when Success is false.<br>Example: <code>null</code></p> |

## Task Changelog

Changelog for Task Frends.Regex.Replace.

### \[1.2.0] - 2026-08-07

#### Changed

* Added error handling support: a new Options parameter lets you control whether errors are thrown as exceptions or returned as part of the result object.
* The task result now includes a `Success` flag and an `Error` property for more consistent error handling.
* Updated target framework to .NET 8.

### \[1.1.0] - 2024-09-11

#### Update

* \[Breaking] Parameter structure has been changed from the version that has been released to NuGet feeds.
* Needed to increase the version number to fix the issue with .Net8 targeted processes not finding correct namespace.

### \[1.0.1] - 2023-06-13

#### Changed

* Documentation updates.

### \[1.0.1] - 2022-02-21

#### Changed

* Targeting changed to only include .NET 6.0 (removed .NET Standard 2.0)

### \[1.0.0] - 2022-02-09

#### Added

* Initial implementation


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.frends.com/tasks/tasks/regex/replace.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
