Contents
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
- PostgreSQL 8.3
- added (commit 9eb78bee)
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)
References
- PostgreSQL documentation: Other String Functions