Hi, Finding all matches in a string is convenient using regexp_matches() with the 'g' flag.
But if instead wanting to know the start and end positions of the occurrences, one would have to first call regexp_matches(...,'g') to get all matches, and then iterate through the results and search using strpos() and length() repeatedly to find all start and end positions. Assuming regexp_matches() internally already have knowledge of the occurrences, maybe we could add a regexp_ranges() function that returns a two-dimensional array, with all the [[start,end], ...] positions? Some other databases have a singular regexp_position() function, that just returns the start positions for the first match. but I don't think such function adds much value, but if adding the pluralis one then maybe the singularis should be added as well, for completeness, since we have array_position() and array_positions(). I just wanted to share this idea now since there is currently a lot of other awesome work on the regex engine, and hear what others who are currently thinking a lot about regexes think of the idea. /Joel