# Replace

> Within a specified input string, replaces strings that match a regular expression pattern with a specified replacement string.

Within a specified input string, replaces strings that match a regular expression pattern with a specified replacement string.

## Definition

**Namespace:** UiPath.Activities.System.API

**Assembly:** UiPath.System.Activities.Api (in UiPath.System.Activities.Api.dll)

## Overloads

|  |  |
| --- | --- |
| `Replace(String, String, String)` | Within a specified input string, replaces strings that match a regular expression pattern with a specified replacement string. |
| `Replace(String, String, String, Regex Options)` | Within a specified input string, replaces strings that match a regular expression pattern, and Regex options, with a specified replacement string. |

## `Replace(String, String, String)`

Within a specified input string, replaces strings that match a regular expression pattern with a specified replacement string.

```
string Replace(
    string input,
    string pattern,
    string replacement
)
```

`input` [String](https://learn.microsoft.com/dotnet/api/system.string) : The string to be replaced.

`pattern` [String](https://learn.microsoft.com/dotnet/api/system.string) : The regular expression pattern to match.

`replacement` [String](https://learn.microsoft.com/dotnet/api/system.string) : The replacement string.

## `Replace(String, String, String, Regex Options)`

Within a specified input string, replaces strings that match a regular expression pattern, and Regex options, with a specified replacement string.

```
string Replace(
    string input,
    string pattern,
    string replacement,
    RegexOptions regexOption
)
```

`input` [String](https://learn.microsoft.com/dotnet/api/system.string) : The string to be replaced.

`pattern` [String](https://learn.microsoft.com/dotnet/api/system.string) : The regular expression pattern to match.

`replacement` [String](https://learn.microsoft.com/dotnet/api/system.string) : The replacement string.

`regexOption` [RegexOptions](https://learn.microsoft.com/dotnet/api/system.text.regularexpressions.regexoptions) : A bitwise combination of the enumeration values that specify options for matching. The available options are `IgnoreCase`, `Multiline`, `ExplicitCapture`, `Compiled`, `Singleline`, `IgnorePatternWhitespace`, `RightToLeft`, `ECMAScript`, and `CultureInvariant`.

## Return value

[String](https://learn.microsoft.com/dotnet/api/system.string)

A new string that is identical to the input string, except that a replacement string takes the place of each matched string.
