0

I'm trying to remove non-ascii characters using PL SQL. I tried to use the codes below but it also removes carriage returns which is I don't want. Please advice.

select REGEXP_REPLACE('sample string', '[^[:print:]]', '') from dual;
  • What does "not found on the keyboard" mean ? Only a-zA-Z0-9 ? There are a ton of different types of keyboard around, most of them have special characters too. – Koen Lostrie Jul 09 '21 at 08:14
  • Hello, sorry. already rephrase my question. I mean characters like À È Ì Ò Ù Ỳ Ǹ Ẁ or any symbols like heart or square? Dont know if thats the right word. – Seigfred Mondez Jul 09 '21 at 08:22

1 Answers1

0

Change the regexp to (not printable OR carriage return/newline).

WITH t (txt) AS
(
SELECT 'Hello'||chr(13)||' World' FROM DUAL
)
select REGEXP_REPLACE(txt, '[^[:print:|\x0A|\x0B|`\x0D]]', '') from t; 

REGEXP_REPLA
------------
Hello
 World

Nicely explained here

Koen Lostrie
  • 14,938
  • 2
  • 13
  • 19