Skip to main content
Skip table of contents

Do you have an Oracle function to anonymize emailadresses?

Situation

Email addresses in your database should be anonymized. 

There are different scenarios possible.

Oracle has the function REGEXP_REPLACE to change textstrings


Explanation

Replace EMAILFIELD by your own Input Email Field for this function.


Replace current input Email Domain by fixed domain (john.doe@example.com → john.doe@internaldomain.com )

CODE
REGEXP_REPLACE(<EMAILFIELD>,'@.*','@internaldomain.com')


Scramble input Email Name and use fixed domain: (john.doe@example.com → xxxx.xxx@internaldomain.com )

CODE
REGEXP_REPLACE(REGEXP_REPLACE(<EMAILVELD>,'([[:alnum:]]){1}', 'x'),'@.*','@internaldomain.com')


Randomize Input Email Name and keep domainname. (john.doe@example.com → rdlqszpo@example.com )

(Requires execute permission on dbms_random package)

CODE
REGEXP_REPLACE(<EMAILFIELD>,'.*@',dbms_random.string('l',length(REGEXP_REPLACE(<EMAILFIELD>,'@.*')))||'@')
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.