Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
(\w)(.+?)(@)(\w)(.+?)(.\w+$)
/
gm

Description

An expression that obfuscates with * following this rule:

<First char from email local part><Five fixed masked symbols>@<first domain letter><Five fixed masked symbols>.<tld domain>

Example: Input: eagles.willys@willbethebest.co.uk Output: e*****@w*****.uk

Submitted by Ernesto Janebro - 3 years ago