Documentation

SQL regular expression functions

InfluxDB 3 Core is in Public Alpha

InfluxDB 3 Core is in public alpha and available for testing and feedback, but is not meant for production use. Both the product and this documentation are works in progress. We welcome and encourage your input about your experience with the alpha and invite you to join our public channels for updates and to share feedback.

Alpha expectations and recommendations

The InfluxDB 3 Core 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 3 Open Source Now in Public Alpha

InfluxDB 3 Open Source is now available for alpha testing, licensed under MIT or Apache 2 licensing.

We are releasing two products as part of the alpha.

InfluxDB 3 Core, is our new open source product. It is a recent-data engine for time series and event data. InfluxDB 3 Enterprise is a commercial version that builds on Core’s foundation, adding historical query capability, read replicas, high availability, scalability, and fine-grained security.

For more information on how to get started, check out: