title: regex in javascript allow only numbers and one dot followed by max 2 number
body: <p>With javascript I want to limit a contenteditable cell, to allow only numbers and one dot and after the dot max 2 number</p>
  
  <p>valid examples:</p>
  
  <ul>
  <li>2</li>
  <li>0.2</li>
  <li>0.35</li>
  <li>.5</li>
  <li>.22</li>
  <li>4.55</li>
  <li>6.4</li>
  <li>6546545.55</li>
  </ul>
  
  <p>in my exaple I 
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function onlyNumberAndADot(element) {
    const invalidChars = /\D/g;
    ob = element.target;
      if (invalidChars.test(ob.textContent)) {
        ob.textContent = ob.textContent.replace(invalidChars, "");
      }
  }
  
  document.getElementById("test1").addEventListener("input", function(event) {
    onlyNumberAndADot(event);
  })</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#test1 {
    border: 1px solid gray;
    padding: 5px;
    width: 100px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table class="table"&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td id="test1" contenteditable="true"&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>only in pure javascript
  I am trying this: [0-9]?(.+)?[0-9]{1,2} but its not okey and I dont know how to implement to my function</p>
  
  <p><a href="https://regexr.com/3q3ao" rel="noreferrer">not a correct example... because of number 6546545.55</a></p>