Skip to main content
Scalar function
NULL value, pattern, or replacement returns NULL. A constant NULL position uses position 1.

Syntax

Scalar

Arguments

Returns

  • Type: STRING
  • Possible values: The string with all matches at or after position replaced.
  • NULL behavior: NULL value, pattern, or replacement returns NULL. A constant NULL position uses position 1.

Properties

Usage notes

  • Characters before position are retained unchanged. Replacements support capture references such as $1 and backslash-1.
  • Position zero or one replaces from the beginning. A larger position counts Unicode characters, preserves the preceding prefix, and leaves the string unchanged if beyond the end. Pattern and replacement columns are handled per row in the generic path.

Examples

Typical behavior

Omitted replacement removes matches

Limitations

  • Position is used only when it is a constant integer. A position column or constant NULL uses position 1. Negative constant positions normally leave the string unchanged.
Last modified on October 15, 2026