> For the complete documentation index, see [llms.txt](https://cgps.gitbook.io/data-flo/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cgps.gitbook.io/data-flo/reference-guide/find-value-in-list.md).

# find-value-in-list

## Description

<mark style="color:purple;">`find-value-in-list`</mark> *adaptor finds a value in a list that matches the search pattern.*

The output returns the value of the first match in the list and its index number.\
To filter a list based on a search pattern use [<mark style="color:purple;">`filter-list`</mark> ](/data-flo/reference-guide/filter-list.md).

## Inputs

**`list`**\
Type: `list`\
Required: Yes\
The list to be searched.

**`pattern`**\
Type: `text`\
Required: Yes\
A text or a regular expression to be searched for within the list.

**`case sensitive`**\
Type: `boolean`\
Required: No\
When set to `False`, lowercase and uppercase letters are treated as equivalent when matching values, e.g. `Peru` = `peru`. If unspecified, defaults to `False`.

**`match diacritics`**\
Type: `boolean`\
Required: No\
When set to `False`, letters with and without diacritics are treated as equivalent when matching values, e.g. `Perú` = `Peru`. If unspecified, defaults to `False`.

## Outputs

**`value`**\
Type: `text`\
The value of the first match in the list.

**`index`**\
Type: `number`\
The one-based index of first match in the list.

## Examples

### Example 1: Default behaviour.

#### Inputs:

`list:`

1. United Kingdom
2. India
3. Perú
4. Turkey
5. United States

`pattern:` United

`case sensitive:` *null (empty)*

`match diacritics:` *null (empty)*

#### Outputs:

`value`: United Kingdom

`index`: 1

-> Found the value `United Kingdom` in the list with the index 1

### Example 2: Find value by setting match diacritic and case sensitive to true.

#### Inputs:

`list:`

1. "Perú"
2. "Peru"
3. "peru"
4. "perú"

`pattern:` perú

`case sensitive:` True

`match diacritics:` True

#### Outputs:

`value`: perú

`index`: 4

-> Found the value `perú` in the list with the index 4. Since both `case sensitive` and `match diatrics` were set to `True`, the adaptor looked for the exact pattern.

### Example 3: Find value by setting match diacritic and case sensitive to false.

#### Inputs:

`list:`

1. "Perú"
2. "Peru"
3. "peru"
4. "perú"

`pattern:` perú

`case sensitive:` False

`match diacritics:` False

#### Outputs:

`value`: Perú

`index`: 1

-> Found the value `Perú` in the list with the index 1. Since both `case sensitive` and `match diatrics` were set to `False`, the adaptor returned the first value that was similar to `perú` .
