Mask Email

Mask an email address for privacy while keeping it recognizable by showing first and last characters.

Code

Utilities
import re
return re.sub(r'^(.)(.*)(.@.*)$', lambda m: m.group(1) + '*' * len(m.group(2)) + m.group(3), email)

Parameters

The email address to mask.

Server

More Python Snippets