REGEXP_SPLIT_TO_ARRAY
Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Splits a string into an array using a regular expression pattern as the delimiter.
<string>: The input text string to split.<pattern>: The regular expression pattern to use as the delimiter.
flags: A string of option flags that modify matching behavior. Flags can be combined (for example,'iq').
| Flag | Description |
|---|---|
i | Case-insensitive matching |
c | Case-sensitive matching (default) |
q | Treat the pattern as a literal string (disables regex metacharacters) |
Returns an array of text values containing all substrings after splitting the input string using the pattern as a delimiter.
- Empty input string: Returns an array with a single empty string
[""]. - Empty pattern: Splits the string into individual characters, including Unicode characters.
- Boundary matches: When the pattern matches at the start or end of the string, empty strings are included in the result array.
- Consecutive matches: Empty strings appear between consecutive delimiter matches.
- Invalid patterns: Throws an error for invalid regex patterns (for example, unsupported lookbehind assertions, invalid quantifiers like
.*+). - Unicode support: Handles multi-byte Unicode characters correctly.
- For simple delimiters without regex features, consider using SPLIT instead.
- For detailed regex syntax, see Regular Expression Syntax.
Split a string on one or more whitespace characters.
Returns array['First', 'Last'].
Split using a character class to match multiple delimiters.
Returns array['abc', '', '', 'XYZ']. Note the empty strings between consecutive digit matches.
Returns array['abc', 'XYZ']. Note there are no empty strings between consecutive digit matches, because the digits were matched as a group.
An empty pattern splits the string into individual characters.
Returns array['a', 'b', 'c'].
Returns array['a', 'é', 'é']. Unicode characters are handled correctly.
When the pattern matches at the start or end, empty strings are included.
Returns array['', '', '']. The pattern matches twice, creating three segments (all empty).
Use the i flag for case-insensitive delimiter matching.
Returns array['', '', ''].
Use the q flag to treat the pattern as a literal string, disabling regex metacharacters.
Returns array['', '']. Without the q flag, \d would match any digit.
Combine flags for case-insensitive literal matching.
Returns array['', ''].
Use word boundary anchors for precise matching.
Returns array['', ' and dogs'].
Returns array['cats ', ' the flat']. Matches only the standalone word "at".
Escape regex metacharacters to match them literally.
Returns array['', ''].
Returns array['', ''].