SPLIT_BY_REGEXP
Descriptionβ
Split the input string into an array of strings according to the specified regular expression.
Syntaxβ
SPLIT_BY_REGEXP ( <str>, <pattern> [, <max_limit>] )
Parametersβ
Parameter | Description |
---|---|
<str> | The string to be split |
<pattern> | Regular expression |
<max_limit> | Optional parameter, whether to limit the number of elements in the returned string array. The default is no limit |
Return Valueβ
Return an array of strings split according to the specified regular expression. Special cases:
- If any of the parameters is NULL, NULL is returned.
Examplesβ
SELECT split_by_regexp('abcde',"");
+------------------------------+
| split_by_regexp('abcde', '') |
+------------------------------+
| ["a", "b", "c", "d", "e"] |
+------------------------------+
select split_by_regexp('a12bc23de345f',"\\d+");
+-----------------------------------------+
| split_by_regexp('a12bc23de345f', '\d+') |
+-----------------------------------------+
| ["a", "bc", "de", "f"] |
+-----------------------------------------+