---
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: 516
product: Flux
version: v0
---

# regexp.compile() function

-   Flux 0.33.0+
-   View 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

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