Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

REGEXP_REPLACE from Set of Characters

getsabyOct 19 2016 — edited Oct 19 2016

Hello,

Need some help with REGEXP_REPLACE usage, when you have Set of Characters that you want to replace like as follows.

  1. Remove ASCII 1-31

  2. Replace long dash/Em dash with short dash/En dash = replace CHR(151) with CHR(150)

  3. Replace left/right double quotes with double quotes = replace CHR(147) & CHR(148) with CHR(34)

  4. Replace left/right single quote with single quote = replace CHR(145) & CHR(146) with CHR(39)

with MYSQL as

(select 'CSC‐113026 - Cisco Systems Capital Corporation' V_STRING

from DUAL)

select V_STRING,ASCIISTR(V_STRING),

--REGEXP_REPLACE(V_STRING,'[' ||UNISTR('\00e200900090')|| ']'),

--REGEXP_REPLACE(V_STRING,'[' ||unistr('\2010')|| ']','-'),

REGEXP_REPLACE(V_STRING,'['||chr(1)||'-'||chr(31)||']','')

--REGEXP_REPLACE((REGEXP_REPLACE(V_STRING,'['||chr(1)||'-'||chr(31)||']','')),'['||chr(151)||']',chr(150))

from MYSQL

Thanks,

Sabegh

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 16 2016
Added on Oct 19 2016
12 comments
2,407 views