---
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: 201
product: Flux
version: v0
publisher: InfluxData
canonical: https://docs.influxdata.com/flux/v0/stdlib/regexp/findstringindex/
date: '2024-04-08T16:01:02-06:00'
lastmod: '2024-04-08T16:01:02-06:00'
---

* Flux 0.33.0+

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

```
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/)
