regex
regex(string: string, [flags: const string]?) -> regex
Builds a value of type regex from a string expression. When the pattern string is known at compile time it is parsed immediately and invalid patterns are compile errors; optional flags is a string literal whose characters must be drawn from c, i, m, and s. When the pattern is not a compile-time constant, compilation still succeeds and the pattern is validated when the pipeline runs. Named capture groups may use Observe’s ?P<name::type> spelling, which the compiler normalizes to ordinary named groups while recording capture typing metadata.
Domain
This is a scalar function (calculates a single output value for a single input row).
Categories
Examples
make_col host_pat: regex("^prod-.*\.internal$")
Creates a reusable regex value from a constant pattern string for later use with match_regex or other regex APIs.
filter match_regex(message, regex(user_supplied_pattern))
Shows a non-constant pattern string so validation happens when the query runs rather than at compile time.
Updated 27 days ago