title: Regex error in Typescript not matching dot
body: <p>I am using this regex to validate input field for allowing only one dot and numbers.
  it works perfectly fine with javascript. But when using it with typescript it only accepts numbers and gives null for dot(.) when matching. </p>
  
  <p>here is my regexobject: </p>
  
  <pre><code>RegExp = new RegExp(/^[0-9]*\.?[0-9]*$/g)
  </code></pre>
  
  <p>And this is how i am using it.</p>
  
  <pre><code>@HostListener('keydown', [ '$event' ])
  onKeyDown(event: KeyboardEvent) {
      if (this.specialKeys.indexOf(event.key) !== -1) {
          return;
      }
      let current: string = this.changeRate.nativeElement.value;
      let next: string = current.concat(event.key);
      console.log(next+" : "+String(next).match(this.regex)+" : " +event.key);
      if (next &amp;&amp; !String(next).match(this.regex)) {
          event.preventDefault();
      }
  }
  </code></pre>