# Regular Expressions and Grouping Sets

DevFeed: [Regular Expressions and Grouping Sets](<https://devfeed.tech/articles/regular-expressions-and-grouping-sets-34563.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2017/08/regular-expressions-and-grouping-sets/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2017-08-14T14:37:53Z

Content type: tutorial

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Regular expression](<https://devfeed.tech/topics/regular-expression.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [data-processing](<https://devfeed.tech/topics/data-processing.md>), [Open Data](<https://devfeed.tech/topics/open-data.md>), [Structured-data](<https://devfeed.tech/topics/structured-data.md>), [CSV](<https://devfeed.tech/topics/csv.md>), [elt](<https://devfeed.tech/topics/elt.md>), [etl](<https://devfeed.tech/topics/etl.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [csv](<https://devfeed.tech/tags/csv.md>), [data-processing](<https://devfeed.tech/tags/data-processing.md>), [elt](<https://devfeed.tech/tags/elt.md>), [etl](<https://devfeed.tech/tags/etl.md>), [functions](<https://devfeed.tech/tags/functions.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [regexp](<https://devfeed.tech/tags/regexp.md>), [regular-expressions](<https://devfeed.tech/tags/regular-expressions.md>), [sql](<https://devfeed.tech/tags/sql.md>), [table](<https://devfeed.tech/tags/table.md>)

## AI overview

A PostgreSQL tutorial showing how to split hierarchical, comma-separated values from a messy column with regular-expression functions, normalize the results, and analyze category distributions with grouping sets, CUBE, and ROLLUP. It also contrasts ETL with ELT.

## Source excerpt

There's a very rich set of PostgreSQL functions to process text, you can find them all at the String Functions and Operators documentation chapter, with functions such as overlay, substring, position or trim. Or aggregates such as string_agg. And then regular expression functions, including the very powerful regexp_split_to_table.