---
title: replace()
slug: replace
docTags: 
createdAt: 2021-09-14T17:47:15.000Z
---

Replaces all substrings within a [String](docId\:Ujw2AQAktel5uukLuP73S) with a different string.

### Syntax

`replace(string, search, replace)`

- `string` - the String value to operate on
- `search` - the String value to search for
- `replace` - the String value to replace in place of any instances of `search`
- **Return type:** [String](docId\:Ujw2AQAktel5uukLuP73S)&#x20;

### Examples

- `replace("hello hello world", "hello", "hi")` returns `hi hi world`

