首页 > 解决方案 > 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?

标签: sqlregexoracle

解决方案


如果你想用正则表达式来做,你可以使用以下内容:

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

推荐阅读