I want to replace equal number of unmatched characters with *
. Like as I've string
xyzdsdasdas@xyss.com
should be replace into
x*********s@x**s.com
Right now just for work around I'm using the following regex
^(\w).*?(.@.).*?(.\.\w+)
So using that followed regex along with preg_replace
like as
echo preg_replace('/^(\w).*?(.@).*?(\.\w+)/', "$1****$2****$3", "xyzdsdasdas@xyss.com");
which result into
x****s@x****s.com
but what I want to achieve over here is
x*********s@x**s.com