v.23.4New Feature

Functions allow non-const patterns and replacements in replaceOne(), replaceAll(), replaceRegexpOne(), and replaceRegexpAll()

Functions replaceOne(), replaceAll(), replaceRegexpOne() and replaceRegexpAll() can now be called with non-const pattern and replacement arguments. #46589 (Robert Schulze).
The string functions replaceOne(), replaceAll(), replaceRegexpOne(), and replaceRegexpAll() now support non-constant pattern and replacement arguments.

Why it matters

This feature allows users to provide dynamic patterns and replacements when using these string replacement functions, enabling more flexible and powerful text manipulations within queries.

How to use it

Simply call the functions replaceOne(), replaceAll(), replaceRegexpOne(), or replaceRegexpAll() with non-constant expressions for the pattern and replacement parameters, for example:

SELECT replaceAll(column, dynamic_pattern, dynamic_replacement) FROM table