Ethem Kuloglu
Ethem Kuloglu

Reputation: 833

String masking with Regex at Oracle

I want to mask name and surname in Oracle. For example; John Smith => Jo** Sm**

I can write a PL/SQL function. But i want to do this with regex. I can't write the right template. Is regex the right solution? Is there anyone who can help?

Upvotes: 1

Views: 1377

Answers (1)

Radagast81
Radagast81

Reputation: 3016

If you want todo it with regexp you can use the following:

REGEXP_REPLACE('John Smith', '(\w{2})\w+', '\1**')

Upvotes: 3

Related Questions