# replace-values-in-list

## Description

<mark style="color:purple;">`replace-values-in-list`</mark> *adaptor replaces specified values in a list using either text or regular expression*.

Use the [<mark style="color:purple;">`import-list-from-text-file`</mark>](/data-flo/reference-guide/import-list-from-text-file.md) adaptor to upload an existing text file, or connect to any other adaptor that outputs a list.

The text matching function is not case-sensitive, use the regular expression option if you need to specify case-sensitivity.

## Inputs

**`list`**\
Type: `list`\
Required: Yes\
The list of text values.

**`pattern`**\
Type: `text`\
Required: Yes\
The text or regular expression to be replaced. The pattern is treated as a regular expression if it begins and ends with `/` (e.g., `/.*/`).

**`replacement`**\
Type: `text`\
Required: No\
The text that replaces all instances of the `pattern`. If unspecified, matches will be replaced with blank text. If a regular expression was used as a pattern, capture groups can be included as `$1`, `$2`, etc.

## Outputs

**`list`**\
Type: `list`\
The list of modified elements

## Examples

### Example 1: Default behaviour.

Inputs:

`list`:

1. green
2. blue
3. red
4. yellow

`pattern`: yellow

`replacement`: brown

#### Outputs:

`list`:

1. green
2. blue
3. red
4. brown&#x20;

-> Replace the value `yellow` in the list with the new value `brown`.


---

# 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://cgps.gitbook.io/data-flo/reference-guide/replace-values-in-list.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.
