Documentation

SQL regular expression functions

The InfluxDB Cloud Serverless SQL implementation uses the PCRE-like regular expression syntax (excluding some features such as look-around and back-references) and supports the following regular expression functions:

regexp_like

True if a regular expression has at least one match in a string; false otherwise.

regexp_like(str, regexp[, flags])
Arguments
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of string operators.
  • regexp: Regular expression to test against the string expression. Can be a constant, column, or function.
  • flags: Optional regular expression flags that control the behavior of the regular expression. The following flags are supported:
    • i: (insensitive) Ignore case when matching.
    • m: (multi-line) ^ and $ match the beginning and end of a line, respectively.
    • s: (single-line) . matches newline (\n).
    • R: (CRLF) When multi-line mode is enabled, \r\n is used to delimit lines.
    • U: (ungreedy) Swap the meaning of x* and x*?.

View regexp_like query example

regexp_match

Returns a list of regular expression matches in a string.

regexp_match(str, regexp, flags)
Arguments
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of string operators.
  • regexp: Regular expression to match against. Can be a constant, column, or function.
  • flags: Regular expression flags that control the behavior of the regular expression. The following flags are supported.
    • i: (insensitive) Ignore case when matching.

View regexp_match query example

regexp_replace

Replaces substrings in a string that match a regular expression.

regexp_replace(str, regexp, replacement, flags)
Arguments
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of string operators.
  • regexp: Regular expression to match against. Can be a constant, column, or function.
  • replacement: Replacement string expression. Can be a constant, column, or function, and any combination of string operators.
  • flags: Regular expression flags that control the behavior of the regular expression. The following flags are supported.
    • g: (global) Search globally and don’t return after the first match.
    • i: (insensitive) Ignore case when matching.

View regexp_replace query example


Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

InfluxDB v3 enhancements and InfluxDB Clustered is now generally available

New capabilities, including faster query performance and management tooling advance the InfluxDB v3 product line. InfluxDB Clustered is now generally available.

InfluxDB v3 performance and features

The InfluxDB v3 product line has seen significant enhancements in query performance and has made new management tooling available. These enhancements include an operational dashboard to monitor the health of your InfluxDB cluster, single sign-on (SSO) support in InfluxDB Cloud Dedicated, and new management APIs for tokens and databases.

Learn about the new v3 enhancements


InfluxDB Clustered general availability

InfluxDB Clustered is now generally available and gives you the power of InfluxDB v3 in your self-managed stack.

Talk to us about InfluxDB Clustered

InfluxDB Cloud Serverless