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 - Replace Strings from position 3 with *

HansMueller69Sep 13 2018 — edited Sep 13 2018

Hi

I'm trying to find a solution for my problem but I can not find out any good idea..

Could you please help me?

I would like to mask a string like this:

- I want to mask only Words, which contain only A-Z and so, that the first 3 characters can be original and the remain should be replaced with *.

The Simpson family consists of fictional characters featured in the animated television series The Simpsons, which debuted on Fox in the U.S. on December 17, 1989..

The Sim**** fam*** con***** of fic****** cha******* fea***** in the ani***** tel******* ser*** The Sim*****, whi** deb**** on Fox in the U.S. on Dec***** 17, 1989..

Any idea?

Maybe in this direction but I can not go further:

SELECT x_text, REGEXP_REPLACE(x_text, '([^| ][A-Z]{3})([A-Z]+)', '*', 1, 0, 'i') AS X_TEXT_NEW

  FROM (SELECT 'The Simpson family consists of fictional characters featured in the animated television series The Simpsons, which debuted on Fox in the U.S. on December 17, 1989..' AS X_TEXT FROM DUAL);

Thanks in advance!

This post has been answered by Frank Kulash on Sep 13 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 11 2018
Added on Sep 13 2018
18 comments
2,927 views