Use regular expressions in Flux

If you’re just getting started with Flux queries, check out the following:

Flux uses Go’s for regular expression search. The links below provide information about Go’s regular expression syntax.

Flux provides two comparison operators for use with regular expressions.

=~

When the expression on the left DOES NOT MATCH the regular expression on the right, this evaluates to true.

When using regex matching in your Flux scripts, enclose your regular expressions with /. The following is the basic regex comparison syntax:

Basic regex comparison syntax

The following example filters records by the cpu tag. It only keeps records for which the is either cpu0, cpu1, or cpu2.

The following example drops columns whose names do not being with _.

Syntax documentation


RE2 Syntax Overview

Go regex testers

Regex Tester - Golang