title: Regular expression for digits, decimals, and fractions
body: <p>How can I create a regex that allows whole numbers, decimals, fractions, and fractions with decimals?
  The string can also have optional text, only at the end.
  So far I have this:</p>
  <pre><code>const re = /^\d*\.?\d*\/?\d*\.?\d*[a-z]*$/gi;
  </code></pre>
  <p>This allows double decimals in a whole number(ie: '23.23.23'), which I do not want. Can I modify this regex to allow two decimal points only if it is separated by a '/'?</p>
  <p>Here are some examples that can pass:</p>
  <ul>
  <li>23.23/100km</li>
  <li>1/3</li>
  <li>.23km</li>
  <li>1.mi</li>
  <li>1.2/2.1kg</li>
  </ul>
  <p>Some examples that shouldn't pass:</p>
  <ul>
  <li>1a3km</li>
  <li>12.12.12</li>
  <li>1.2.3/12.13km</li>
  <li>12km/12.44km</li>
  </ul>