Mega Code Archive

 
Categories / Oracle PLSQL / Regular Expressions
 

Using backreference

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>