title: Regular expression for email masking
body: <p>I am trying to write a regular expression to mask an email address. Example below.</p>
  <blockquote>
  <p>input: john.doe@example.en.com</p>
  <p>output: j*******@e*********.com</p>
  </blockquote>
  <p>I have tried the following but I just can't seem to get it working correctly.</p>
  <blockquote>
  <p>regex:<code>(?&lt;=.).(?=[^@]\*?@)</code></p>
  <p>output:j*******@example.en.com</p>
  <p>regex:<code>(?&lt;=.).(?=[^@]\*?)(?=[^\.]\*?\.)</code></p>
  <p>output:j******************.com</p>
  </blockquote>
  <p>Any help would be appreciated.
  <a href="https://regex101.com/r/ZUGJDC/1" rel="noreferrer">demo</a></p>