Oracle PL/SQL/Regular Expressions/REGEXP REPLACE — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 10:02, 26 мая 2010
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>
REGEXP_REPLACE("Mississippi", "si", "SI", 1, 0, "i")
SQL> SELECT REGEXP_REPLACE("Mississippi", "si", "SI", 1, 0, "i") FROM dual;
REGEXP_REPL
-----------
MisSIsSIppi
SQL>
REGEXP_REPLACE("This is a test", "t.+t","XYZ")
SQL> -- REGEXP_INSTR(String to search, Pattern, [Position, [Occurrence, [Return-option, [Parameters]]]])
SQL>
SQL> SELECT REGEXP_REPLACE("This is a test", "t.+t","XYZ") FROM dual;
REGEXP_REPLAC
-------------
This is a XYZ
SQL>
SQL>