diff --git a/docs/en/sql-reference/functions/splitting-merging-functions.md b/docs/en/sql-reference/functions/splitting-merging-functions.md index f3d71b87a26..d61896b6d98 100644 --- a/docs/en/sql-reference/functions/splitting-merging-functions.md +++ b/docs/en/sql-reference/functions/splitting-merging-functions.md @@ -109,22 +109,22 @@ splitByRegexp(, ) Returns an array of selected substrings. Empty substrings may be selected when: -Type: [Array](../../sql-reference/data-types/array.md) of [String](../../sql-reference/data-types/string.md). - A non-empty regular expression match occurs at the beginning or end of the string; - There are multiple consecutive non-empty regular expression matches; - The original string `s` is empty while the regular expression is not empty. +Type: [Array](../../sql-reference/data-types/array.md) of [String](../../sql-reference/data-types/string.md). **Example** ``` sql -SELECT splitByRegexp('\\d+', 'a1bc2de3f') +SELECT splitByRegexp('\\d+', 'a12bc23de345f') ``` ``` text -┌─splitByRegexp('\\d+', 'a1bc2de3f')─┐ -│ ['a','bc','de','f'] │ -└────────────────────────────────────┘ +┌─splitByRegexp('\\d+', 'a12bc23de345f')─┐ +│ ['a','bc','de','f'] │ +└────────────────────────────────────────┘ ``` ``` sql @@ -196,4 +196,3 @@ Result: │ [['abc','123'],['8','"hkl"']] │ └───────────────────────────────────────────────────────────────────────┘ ``` - diff --git a/tests/queries/0_stateless/01866_split_by_regexp.sql b/tests/queries/0_stateless/01866_split_by_regexp.sql index 45ea1ef164a..e472fb68d94 100644 --- a/tests/queries/0_stateless/01866_split_by_regexp.sql +++ b/tests/queries/0_stateless/01866_split_by_regexp.sql @@ -1,5 +1,5 @@ -select splitByRegexp('\\d+', 'a1ba5ba8b'); +select splitByRegexp('\\d+', x) from (select arrayJoin(['a1ba5ba8b', 'a11ba5689ba891011b']) x); select splitByRegexp('', 'abcde'); select splitByRegexp('<[^<>]*>', x) from (select arrayJoin(['

hello

world

', 'gbyebug']) x); select splitByRegexp('ab', ''); -select splitByRegexp('', ''); \ No newline at end of file +select splitByRegexp('', '');