REGEXP_REPLACE('H1234 H4321 H2345','(.*) (.*) (.*)','\3, \2 \1') : REGEXP_REPLACE « Regular Expressions « Oracle PL / SQL






REGEXP_REPLACE('H1234 H4321 H2345','(.*) (.*) (.*)','\3, \2 \1')


SQL> --For a better example of using backreference, let's suppose we wanted to convert a 
name in the form "first middle last" into the "last, middle first" format. Consider this command:
SQL>
SQL> SELECT REGEXP_REPLACE('H1234 H4321 H2345','(.*) (.*) (.*)','\3, \2 \1')FROM dual;

REGEXP_REPLACE('H1
------------------
H2345, H4321 H1234

SQL>
SQL>
           
       








Related examples in the same category

1.REGEXP_REPLACE('This is a test', 't.+t','XYZ')
2.REGEXP_REPLACE('Mississippi', 'si', 'SI', 1, 0, 'i')