---
title: regexp.findStringIndex() function
description: regexp.findStringIndex() returns a two-element array of integers that represent the beginning and ending indexes of the first regular expression match in a string.
url: https://docs.influxdata.com/flux/v0/stdlib/regexp/findstringindex/
estimated_tokens: 614
product: Flux
version: v0
---

# regexp.findStringIndex() function

-   Flux 0.33.0+
-   View InfluxDB support

`regexp.findStringIndex()` returns a two-element array of integers that represent the beginning and ending indexes of the first regular expression match in a string.

##### Function type signature

```js
(r: regexp, v: string) => [int]
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## Parameters

### r

(Required) Regular expression used to search `v`.

### v

(Required) String value to search.

## Examples

### Index the bounds of first regular expression match in each row

```js
import "regexp"

regexp.findStringIndex(r: /ab?/, v: "tablet")// Returns [1, 3]

```

#### Related

-   [regexp.compile() function](/flux/v0/stdlib/regexp/compile/)
-   [Work with regular expression types](/flux/v0/data-types/basic/regexp/)
