title: Javascript Regular Expression to format text to thousands including decimals
body: <p>I am trying to give format to an input on blur where a number is typed. So if I type: 1234 and blur out of the input, the input take this format: 1.234.
  I got this working with this regular expression 
  <code>/(\d)(?=(\d{3})+(?!\d))/g</code> and this replace string value <code>$1.</code>. Like this:</p>
  
  <pre><code>value.replace(this._mask.regex, this._mask.replaceString)
  </code></pre>
  
  <p>...until decimals where included.</p>
  
  <p>So when I type 1234,9999 I get 1.234,9.999. I am kind of a beginner with regular expressions and I want to add something to the existing regular expression that avoids formatting the values after the comma.</p>