REGEXP_REPLACE - remove new line \n from string ONLY if is enclosed in ()'s
994289Mar 1 2013 — edited Mar 1 2013Hello all,
I'm trying to use REGEXP_REPLACE to replace all new line (\n) from a string with one exception - they MUST be enclosed in parentheses to be replaced.
Example:
Before String:
'a\n, b\n, c (a\n, b, c\n), d\n, e'
(equivalent)
var1 := 'a'||chr(10)||', b'||chr(10)||', c (a'||chr(10)||', b, c'||chr(10)||'), d'||chr(10)||', e'
(or simple substitute with newline as below)
var1 := 'a
, b
, c (a
, b, c
), d
, e'
After string:
'a\n, b\n, c, (a b c), d\n, e'
or console display:
'a
, b
, c (a, b, c), d
, e'
I know there must be a clean regular expression pattern that can do this - but I can't get my head around it.
thanks very much...
Edited by: 991286 on Mar 1, 2013 11:35 AM