---
title: testing.assertMatches() function
description: testing.assertMatches() tests whether a string matches a given regex.
url: https://docs.influxdata.com/flux/v0/stdlib/internal/testing/assertmatches/
estimated_tokens: 141
product: Flux
version: v0
publisher: InfluxData
canonical: https://docs.influxdata.com/flux/v0/stdlib/internal/testing/assertmatches/
date: '2024-04-08T16:01:02-06:00'
lastmod: '2024-04-08T16:01:02-06:00'
---

* Flux LATEST+

InfluxDB support

`testing.assertMatches()` tests whether a string matches a given regex.

##### Function type signature

```js
(got: string, want: regexp) => stream[{v: string, _diff: string}]
```

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

## Parameters

### got

(Required)
Value to test.

### want

(Required)
Regex to test against.

## Examples

### Test if two values are equal

```js
import "internal/testing"

testing.assertMatches(got: "123", want: /12/)
```

[tests](/flux/v0/tags/tests/)
