Skip to content
masterclass Buddy

PostgreSQL · Function

regexp_replace

PostgreSQL's regexp_replace replaces text that matches a POSIX regular expression. It can change the first match, one selected match, or all matches.

Last updated

Syntax

regexp_replace(string, pattern, replacement [, flags])
regexp_replace(string, pattern, replacement, start [, N [, flags]])

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • regexp_match
  • regexp_matches
  • regexp_substr
  • regexp_split_to_array
  • regexp_split_to_table
  • replace

Source: PostgreSQL: Documentation: 18: 9.7. Pattern Matching. Checked 2026-11-03.