> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reelevant.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Replace

> Replace text in a string

## Overview

The `replace` transformation replaces occurrences of a substring within a string.

## Syntax

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
replace(<variable>, search="", isRegex=false, replace="")
```

## Parameters

| Parameter  | Type    | Required | Description                                       |
| ---------- | ------- | -------- | ------------------------------------------------- |
| `variable` | string  | Yes      | The string to search in                           |
| `search`   | string  | Yes      | The substring or regex pattern to find            |
| `isRegex`  | boolean | Yes      | Whether the search string is a regular expression |
| `replace`  | string  | Yes      | The replacement string                            |

## Examples

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
replace(<variable>, search="old", isRegex=false, replace="new")
replace(<variable>, search="[0-9]+", isRegex=true, replace="X")
```

<Info>
  For replacing with a variable value, see [Replace with Variable](/advanced-guide/transformations/replace-variable).
</Info>
