title: Kotlin / Regex - Replace a group of pattern with a repeating character
body: <p>I would like to mask the email passed in the <code>maskEmail</code> function. I'm currently facing a problem wherein the <strong>asterisk <code>*</code> is not repeating when i'm replacing group 2 and and 4</strong> of my pattern.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>fun maskEmail(email: String): String {
      return email.replace(Regex("(\\w)(\\w*)\\.(\\w)(\\w*)(@.*\\..*)$"), "$1*.$3*$5")
  }
  </code></pre>
  
  <p>Here is the input:</p>
  
  <pre><code>tom.cat@email.com
  cutie.pie@email.com
  captain.america@email.com
  </code></pre>
  
  <p>Here is the current output of that code:</p>
  
  <pre><code>t*.c*@email.com
  c*.p*@email.com
  c*.a*@email.com
  
  </code></pre>
  
  <p><strong>Expected output:</strong></p>
  
  <pre><code>t**.c**@email.com
  c****.p**@email.com
  c******.a******@email.com
  </code></pre>
  
  <p>Edit:
  I know this could be done easily with for loop but <strong>I would need this to be done in regex.</strong> Thank you in advance.</p>