Skip to main content
Skip to main content

SPLIT_BY_REGEXP

split_by_regexp​

description​

Syntax​

ARRAY<STRING> split_by_regexp(STRING str, STRING pattern[, int max_limit])

Split the string 'str' based on the input regular expression 'pattern', with the option to retain up to the maximum number 'max_imit'. By default, all strings will be retained, and a split string array will be returned.

Arguments​

Str - The string that needs to be split Type: String Pattern - Regular expression Type: String Max_imit - Reserved number, optional parameter Type: Int

example​

mysql [test_query_qa]>select split_by_regexp('abcde',"");
+------------------------------+
| split_by_regexp('abcde', '') |
+------------------------------+
| ["a", "b", "c", "d", "e"] |
+------------------------------+
1 row in set (0.02 sec)

mysql [test_query_qa]>select split_by_regexp('a12bc23de345f',"\\d+");
+-----------------------------------------+
| split_by_regexp('a12bc23de345f', '\d+') |
+-----------------------------------------+
| ["a", "bc", "de", "f"] |
+-----------------------------------------+
1 row in set (0.01 sec)

keywords​

SPLIT_BY_REGEXP,SPLIT