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

# REPLACE

> Replaces all literal occurrences of a substring.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

Returns NULL for a NULL provided argument.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
replace(value, search [, replacement])
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | STRING | Yes | The string. |
| search | STRING | Yes | The literal substring. |
| replacement | STRING | No | Replacement text. Default: Empty string. |

## Returns

* Type: STRING
* Possible values: The replaced string.
* NULL behavior: Returns NULL for a NULL provided argument.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Usage notes

* An empty search string inserts the replacement before every Unicode character and at both ends. Omitting replacement is equivalent to an empty string.

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT replace('abcabc', 'ab', 'X') AS replaced, replace('abcabc', 'ab') AS removed;
```

| replaced | removed |
| - | - |
| XcXc | cc |

### Omit the replacement to remove matches

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT replace('banana', 'a') AS result;
```

| result |
| - |
| bnn |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.