select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

FUNCTIONS / STRING FUNCTIONS AND OPERATORS

regexp_matches

Read PG 18 manual ↗

Returns substrings within the first match of the POSIX regular expression pattern to the string, or substrings within all such matches if the g flag is used; see Section 9.7.3.

Signatures & examples

regexp_matches ( string text, pattern text [, flags text ] ) → setof text[]
Returns substrings within the first match of the POSIX regular expression pattern to the string, or substrings within all such matches if the g flag is used; see Section 9.7.3.
regexp_matches('foobarbequebaz', 'ba.', 'g') → {bar}
{baz}
Version history 4
  1. PG 18 → 19changed
  2. PG 14 → 15changed
  3. PG 12 → 13changed
  4. PG 9.6 → 10changed

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source