# REPLACE

The REPLACE function replaces an input text string with a given value for a specified index and length. Node references are also accepted as arguments. The index starts at 1 i.e. the first character of the input string will have an index of 1.&#x20;

### Syntax

```javascript
replace(old_string:string, index:number, length:number, replace_text:string)
```

### Arguments

old\_string- A text string.Required.&#x20;

index- A number indicating the position at which the string should be replaced.Required.&#x20;

length- A number indicating the number of characters to be replaced in the input string.Required.&#x20;

replace\_text- A text string that will replace a part/all of the old\_string parameter.Required.

### Example

```javascript
REPLACE('INFORIVER', 1, 4, 'LUMEL')
//Returns “LUMELRIVER"
```

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FZOg76Z4EcdAQdiKuJb2L%2Fimage.png?alt=media&#x26;token=02cbdeba-df48-4841-86b2-46aada339025" alt=""><figcaption><p>Replace function</p></figcaption></figure>

### **Excel equivalent**

[**Replace**](https://support.microsoft.com/en-us/office/replace-function-8d799074-2425-4a8a-84bc-82472868878a)


---

# Agent Instructions: 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:

```
GET https://docs.inforiver.com/formula-syntax/text-formatting-functions/replace.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
