mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Allow to extract empty matches in "extractAll" function #1493.
This commit is contained in:
parent
729b114c15
commit
14e069f748
@ -305,13 +305,13 @@ public:
|
|||||||
if (!pos || pos > end)
|
if (!pos || pos > end)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!re->match(pos, end - pos, matches) || !matches[capture].length)
|
if (!re->match(pos, end - pos, matches) || !matches[0].length)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
token_begin = pos + matches[capture].offset;
|
token_begin = pos + matches[capture].offset;
|
||||||
token_end = token_begin + matches[capture].length;
|
token_end = token_begin + matches[capture].length;
|
||||||
|
|
||||||
pos += matches[capture].offset + matches[capture].length;
|
pos += matches[0].offset + matches[0].length;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
{"a":"1","b":"2","c":"","d":"4"} ['a','b','c','d'] ['1','2','','4']
|
@ -0,0 +1,4 @@
|
|||||||
|
SELECT
|
||||||
|
'{"a":"1","b":"2","c":"","d":"4"}' AS json,
|
||||||
|
extractAll(json, '"([^"]*)":') AS keys,
|
||||||
|
extractAll(json, ':"([^"]*)"') AS values;
|
Loading…
Reference in New Issue
Block a user