Using regexp_replace to replace control chars and ;
tinku981Dec 11 2012 — edited Dec 11 2012Hello,
I wanted to replace control characters by SPACE and semi colon (;) by comma (,) that are in same column. Could you please help me same?
create table t (char_value varchar2(30));
insert into t (char_value) values ('a' || chr(9) || 'b' || chr(10) || 'c' || chr(13) || 'd' || ';');
select * from t;
Following is desired output which can be achieved by translate
a b c d,
select translate(char_value,chr(9)||chr(10)||chr(13)||';',' ,') from t;
But can we do same by using regular expression. I am able to just replace the control character but not able to use same for replace ;
select regexp_replace(char_value, '[[:cntrl:]]', ' ') from t;
Thanks in advance,