REGEXP_REPLACE

REGEXP_REPLACE(inputString, regexString, replacementString [, flagsString])

Description

Replaces each substring that matches a regular expression. For details, see the Java String.replaceAll() method. If any parameter is null (except optional flagsString parameter), the result is null.

Flags values limited to 'i', 'c', 'n', 'm'. Other symbols causes exception. Multiple symbols could be uses in one flagsString parameter (like 'im'). Later flags overrides first ones, for example 'ic' equivalent to case sensitive matching 'c'.

  • 'i' enables case insensitive matching (Pattern.CASE_INSENSITIVE)

  • 'c' disables case insensitive matching (Pattern.CASE_INSENSITIVE)

  • 'n' allows the period to match the newline character (Pattern.DOTALL)

  • 'm' enables multiline mode (Pattern.MULTILINE)

Examples

SELECT REGEXP_REPLACE(name, 'w+', 'W', 'i') FROM Players;