title: Insert comma into digits and decimal number with regex
body: <p>I saw many posts to insert comma into just digits or decimal numbers, but not both, so let me ask here.</p>
  <pre><code>1234 -&gt; 1,234
  1234567 -&gt; 12,34,567
  123 -&gt; 123
  1234.123 -&gt; 1,234.123
  0.123 -&gt; 0.123
  0.12345 -&gt; 0.12345
  </code></pre>
  <p>I wanna insert comma like this using regex but I cannot make one which support both digits and decimal numbers.</p>
  <p>I tried these but didnt work....</p>
  <pre><code>/(\d)(?=(\d{3})+)/
  /\B(?=(\d{3})+(?!\d))\.?\d*/
  </code></pre>
  <p>Any idea to make it work?</p>