Oracle SQL - REGEXP_REPLACE function

Introduction

REGEXP_REPLACE function returns the source_string with every occurrence of the pattern_to_find replaced by replace_string.

The simplest format for this function is:

REGEXP_REPLACE  (source_string,  pattern_to_find, 
  pattern_to_replace_by) 

The general format for the REGEXP_REPLACE function with all the options is:

REGEXP_REPLACE  (source_string,  pattern_to_find, 
   [pattern_to_replace_by,  position,  occurrence, 
   match_parameter]) 

Demo

SQL>
SQL>-- w  w w  .  j  av  a  2 s  . c o  m
SQL> SELECT  REGEXP_REPLACE('Mississippi',  'si',  'SI',  1,  0,  'i')
  2  FROM  dual ;

REGEXP_REPL
-----------
MisSIsSIppi

SQL>