Replace every comma in the nested parenthesis with space using regexp

Viewed 16

Consider I have the following string

"[NUMBER_ID#150, SYSTEM_ID#149, CASE WHEN (length(CALLED_NUM#177) = 11) THEN substring(CALLED_NUM#177, 2, 10) ELSE CALLED_NUM#177 END AS CONTACT#341, ACTUAL_CALL_DURATION_SEC#184, 2 AS type#261, trunc(cast(CALL_START_TIME#148 as date), MM) AS _groupingexpression#407]"

I wish to replace every comma inside round brackets with space so the result will be

"[NUMBER_ID#150, SYSTEM_ID#149, CASE WHEN (length(CALLED_NUM#177) = 11) THEN substring(CALLED_NUM#177 2 10) ELSE CALLED_NUM#177 END AS CONTACT#341, ACTUAL_CALL_DURATION_SEC#184, 2 AS type#261, trunc(cast(CALL_START_TIME#148 as date) MM) AS _groupingexpression#407]"

How to do so?

0 Answers
Related