v.20.5New Feature
Add extractAllGroupsHorizontal and extractAllGroupsVertical functions
Add functionsextractAllGroupsHorizontal(haystack, re)andextractAllGroupsVertical(haystack, re). #11554 (Vasily Nemkov).
Why it matters
These functions provide enhanced regular expression extraction capabilities by allowing users to extract all captured groups either horizontally (across matches) or vertically (down groups) from a given string. This solves the problem of efficiently retrieving multiple regex groups in a structured manner, improving text parsing and data extraction workflows.How to use it
UseextractAllGroupsHorizontal(haystack, re) to extract all regex groups row-wise (horizontally) and extractAllGroupsVertical(haystack, re) to extract them column-wise (vertically). Both functions require a haystack string to search in and a regular expression re with capture groups defined, for example:SELECT extractAllGroupsHorizontal('abc123def456', '(\D+)(\d+)');
SELECT extractAllGroupsVertical('abc123def456', '(\D+)(\d+)');