Skip to Main Content

REGEXP_REPLACE - remove commas from string ONLY if not enclosed in ()'s

564484Jun 12 2008 — edited Oct 26 2009
Hello all,

I'm trying to use REGEXP_REPLACE to replace all commas from a string with one exception - they must NOT be enclosed in parentheses to be replaced.


Before String: 'a, b, c (a, b, c)'

After string: 'a b c (a, b, c)'

I know there must be a clean regular expression pattern that can do this - but I can't get my head around it. I've tried using the "[^\(.*,.*\)]" pattern - but it seems to treat the enclosed pattern as just a list of single characters to NOT match.

I know you regular expression experts probably could answer this in about 5 seconds - so I thought I would post this question...

thanks very much...
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Nov 23 2009
Added on Jun 12 2008