Use regexp_replace to blank-out or remove the parentheses and words in it?
843098Feb 28 2011 — edited Feb 28 2011If I need to remove parenthese and wordings within it from the input data, what should be the pattern I used in the regexp_replace?
Again, it works on (), and {} but not [], how should I write in the pattern of regexp_replace?
select 'What a good day for (YOU [ME] and {HIM}) and others',
REGEXP_REPLACE('What a good day for (YOU [ME] and {HIM}) and others', '\([^()]*\)', '')
from dual
SQL> What a good day for and others
select 'What a good day for (YOU [ME] and {HIM}) and others',
REGEXP_REPLACE('What a good day for (YOU [ME] and {HIM}) and others', '\{[^{}]*\}', '')
from dual
SQL> What a good day for (YOU [ME] and ) and others
*** NOT WORKING FOR [ ] below ***
select 'What a good day for (YOU [ME] and {HIM}) and others',
REGEXP_REPLACE('What a good day for (YOU [ME] and {HIM}) and others', '\[[^[]]*\]', '')
from dual
SQL> What a good day for (YOU [ME] and {HIM}) and others
Can anyone help??
Appreciate,the answer you provide.
Fiona