I\'m a newbie in regular expressions. I want to replace any text string symbols like (,),[,] to hyphens (for example):
SELECT REGEXP_REPLACE (\'()\',
To replace symbols, use the TRANSLATE function, it is less processor-intensive than regular expression functions:
SQL> SELECT translate ('()', '()[]', '----') replaced FROM dual;
REPLACED
--------
--
Regular expressions are more versatile and can do more complex things but are more expensive. In this case, replacing one character by another is done more efficiently by a specialized function. If you really want to use regular expressions, you could use REGEXP_REPLACE:
SQL> SELECT regexp_replace ('[()]', '[]()[]', '-', 1, 0) reg FROM dual;
REG
---------
----
Update: If you want to replace only the first symbol, translate won't work. Instead, use:
SQL> SELECT regexp_replace ('[()]', '[]()[]', '-', 1, 1) reg FROM dual;
REG
---------
-()]