Minor changes in splitByRegexp

This commit is contained in:
Vladimir 2021-05-13 12:21:00 +03:00 committed by GitHub
parent 452dec891d
commit 7c77dd1e21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View File

@ -109,22 +109,22 @@ splitByRegexp(<regexp>, <s>)
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')─┐
┌─splitByRegexp('\\d+', 'a12bc23de345f')─┐
│ ['a','bc','de','f'] │
└────────────────────────────────────┘
└────────────────────────────────────────
```
``` sql
@ -196,4 +196,3 @@ Result:
│ [['abc','123'],['8','"hkl"']] │
└───────────────────────────────────────────────────────────────────────┘
```

View File

@ -1,4 +1,4 @@
select splitByRegexp('\\d+', 'a1ba5ba8b');
select splitByRegexp('\\d+', x) from (select arrayJoin(['a1ba5ba8b', 'a11ba5689ba891011b']) x);
select splitByRegexp('', 'abcde');
select splitByRegexp('<[^<>]*>', x) from (select arrayJoin(['<h1>hello<h2>world</h2></h1>', 'gbye<split>bug']) x);
select splitByRegexp('ab', '');