SPLIT_BY_STRING

Overview

Splits a string by a literal string delimiter and returns an ARRAY<STRING>. Unlike SPLIT, the delimiter is treated as a literal string rather than a regular expression, making it safe for delimiters that contain regex special characters (such as :: or |).

Syntax

SPLIT_BY_STRING(<str>, <delimiter>)

Parameters

  • <str>: STRING type. The string to split.
  • <delimiter>: STRING type. The literal string delimiter; not interpreted as a regular expression.

Examples

SELECT split_by_string('a::b::c', '::'); -- ["a","b","c"] -- Safe when the delimiter contains regex special characters SELECT split_by_string('a|b|c', '|'); -- ["a","b","c"]