Archivo de la etiqueta: correoe

Enmascarado de correos electrónicos

Una expresión regular para enmascarar correos electrónicos.

SELECT result1 ORIGINAL_EMAIL,
    regexp_replace(
        regexp_replace(result1, '[^[:alnum:]._%+-@]', ''), -- Remove non-digit, non-alphabetic and special email characters
        '^([[:alnum:]._%+-]{2})([[:alnum:]._%+-]*)(@)([[:alnum:]._%+-]{2})([[:alnum:]._%+-]*)(\.{1}[[:alpha:]]{2,}$)', -- Email pattern
        '\1*\3\4*\6') MASK_EMAIL -- Mask
FROM ( 
    WITH test AS
     (SELECT 'n.surname@domain.ext,nsurname@subd.domain.ext,name-surname@domain.ext' col1 FROM dual) 
    SELECT regexp_substr(col1, '[^,]+', 1, rownum) result1 
      FROM test 
    CONNECT BY LEVEL <= regexp_count(col1, ',') + 1);

El resultado es:

ORIGINAL_EMAIL                   MASK_EMAIL
-------------------------------- -------------
n.surname@domain.ext             n.*@do*.ext
nsurname@subd.domain.ext         ns*@su*.ext
name-surname@domain.ext          na*@do*.ext
Anuncio publicitario