Oracle PL/SQL/Regular Expressions/Escape — различия между версиями

Материал из SQL эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 10:02, 26 мая 2010

Change a dollar sign to a blank space

SQL> --Change a dollar sign to a blank space:
SQL>
SQL> SELECT REGEXP_REPLACE("$1,234.56","$"," ") FROM dual;
REGEXP_REP
----------
$1,234.56
SQL>
SQL> -- This query "failed" because what was intended was a match for a "$" rather 
than the use of the "$" as an anchor. To match the "$" in an RE, we use the escape 
character like this:
SQL>
SQL> SELECT REGEXP_REPLACE("$1,234.56","\$"," ") FROM dual;
REGEXP_RE
---------
 1,234.56
SQL>
SQL>