Documentation

    string_split_regex

    Split text at each match of a regular expression and return the parts as a list. An optional argument sets regex options.

    Also available as regexp_split_to_array, str_split_regex.

    Try an expression

    In Formula, enter the expression and set Output type to VARCHAR.

    Expression

    string_split_regex('hello world; 42', ';? ')

    Result

    '[hello, world, 42]'

    The expression returns VARCHAR[]. Formula stores it as VARCHAR in this example. To use your own data, replace the example values with column names. Keep format strings and other options as written.

    Arguments and types

    string_split_regex(string, regex, options)
    string
    Text
    regex
    Text
    options
    Text
    Supported signatures (2)
    string_split_regex(string: VARCHAR, regex: VARCHAR) → VARCHAR[]
    string_split_regex(string: VARCHAR, regex: VARCHAR, options: VARCHAR) → VARCHAR[]

    The result type can depend on the input types. See DuckDB for the full argument rules.

    Things to know

    If the first argument is missing, the result is NULL.

    Browse patternsDuckDB documentation

    Function metadata from DuckDB, used under the MIT license.