title: Replace all instances of character in string in typescript?
body: <p>I'm trying to replace all full stops in an email with an x character - for example "my.email@email.com" would become "myxemail@emailxcom". Email is set to a string.<br>
  My problem is it's not replacing just full stops, it's replacing every character, so I just get a string of x's.<br>
  I can get it working with just one full stop, so I'm assuming I'm wrong on the global instance part. Here's my code:</p>
  
  <pre><code>let re = ".";
  let new = email.replace(/re/gi, "x");
  </code></pre>
  
  <p>I've also tried   </p>
  
  <pre><code>re = /./gi;
  new = email.replace(re, "x");
  </code></pre>
  
  <p>If anyone can shed any light I'd really appreciate it, I've been stuck on this for so long and can't seem to figure out where I'm going wrong.</p>
  
  <p>** Edit: Whoops, my new variable was actually called newemail, keyword new wasn't causing the issue!</p>