ClickHouse/tests/queries/0_stateless/01246_extractAllGroups.reference
Vasily Nemkov 87b2d90725 extractAllGroups(haystack, re_needle) function
Function that extracts from haystack all matching non-overlapping groups with regular expressions,
and put those into Array(Array(String)) column.

Example:
:) SELECT extractAllGroups('abc=111, def=222, "jkl mno"="444 foo bar"', '("[^"]+"|\\w+)=("[^"]+"|\\w+)');

┌─extractAllGroups('abc=111, def=222, "jkl mno"="444 foo bar"', '("[^"]+"|\\w+)=("[^"]+"|\\w+)')─┐
│ [['abc','def','"jkl mno"'],['111','222','"444 foo bar"']]                                      │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
2020-05-05 17:41:31 +03:00

24 lines
470 B
Plaintext

0 groups, zero matches
[]
1 group, multiple matches, String and FixedString
[['hello','world']]
[['hello','world']]
[['hello','world']]
[['hello','world']]
[['hello','world']]
[['hello','world']]
mutiple groups, multiple matches
[['abc','def','ghi','"jkl mno"'],['111','222','333','"444 foo bar"']]
big match
0 1 0 []
260 1 1 [156]
520 1 3 [156,156,156]
lots of matches
0 1 0 0
260 1 260 260
520 1 520 520
lots of groups
0 100 0 []
260 100 2 [1,1]
520 100 5 [1,1,1,1,1]