regexp_split_to_table()

A function for splitting a string to a table using a regular expression

regexp_split_to_table() is a system function for splitting a string into a table using a POSIX regular expression as the delimiter.

regexp_split_to_table() was added in PostgreSQL 8.3.

Usage

regexp_split_to_table ( string text, pattern text [, flags text ] ) → text[]

A list of flags (other than 'g') is available in the PostgreSQL documentation: ARE Embedded-Option Letters.

Change history

Examples

Basic usage example for regexp_split_to_table():

postgres=# SELECT regexp_split_to_table('foo  bar baz', '\s+');
 regexp_split_to_table 
-----------------------
 foo
 bar
 baz
(3 rows)

Categories

String manipulation, System function

See also

string_to_table(), string_to_array(), regexp_split_to_array(), split_part()