---
title: regexp.compile() function
description: regexp.compile() parses a string into a regular expression and returns a regexp type that can be used to match against strings.
url: https://docs.influxdata.com/flux/v0/stdlib/regexp/compile/
estimated_tokens: 173
product: Flux
version: v0
publisher: InfluxData
canonical: https://docs.influxdata.com/flux/v0/stdlib/regexp/compile/
date: '2024-04-08T16:01:02-06:00'
lastmod: '2024-04-08T16:01:02-06:00'
---

* Flux 0.33.0+

InfluxDB support

`regexp.compile()` parses a string into a regular expression and returns a regexp type
that can be used to match against strings.

##### Function type signature

```js
(v: string) => regexp
```

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

## Parameters

### v

(Required)
String value to parse into a regular expression.

## Examples

### Convert a string into a regular expression

```
import "regexp"

regexp.compile(v: "abcd")// Returns the regexp object /abcd/

```

#### Related

* [Work with regular expression types](/flux/v0/data-types/basic/regexp/)

[type-conversions](/flux/v0/tags/type-conversions/)
