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

# testing.assertMatches() function

-   Flux LATEST+
-   View 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/)
