'I know how to masking half of the part of email using rgx_exp, but i want to know how to mask half of the phone number using egx_exp in sql?

enter image description here

------------im using this one masking email------------

CREATE OR REPLACE MASKING POLICY PERSONAL_INFO.Email_Policy AS (email string) returns string ->
case when current_role() in ('MASK_ADMIN') then email
when current_role() in ('ACCOUNTADMIN') then regexp_replace(email,'.+\@','*****@')
else '**Masked Email**'
END;


ALTER TABLE CUSTOMERDETAILS MODIFY COLUMN email set MASKING POLICY PERSONAL_INFO.Email_Policy;
sql


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source