v.20.5New Feature

Add extractAllGroupsHorizontal and extractAllGroupsVertical functions

Add functions extractAllGroupsHorizontal(haystack, re) and extractAllGroupsVertical(haystack, re). #11554 (Vasily Nemkov).
Added two new functions extractAllGroupsHorizontal(haystack, re) and extractAllGroupsVertical(haystack, re) for extracting regex groups from strings in different orientations.

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

Use extractAllGroupsHorizontal(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+)');