title: JS - Regex for number without leading zero, or just zero
body: <p>I am trying to write a regular expression for currency (no commas or $ signs or periods; just integers), but I am hitting a wall. </p>
  
  <p>I need a the number (as a string) to match a pattern to validate.</p>
  
  <p>The following are what I need:<br>
  1. the number can be a single zero<br>
  2. the number cannot have leading zeroes  </p>
  
  <p>Valid Input:
  0
  12345
  1230</p>
  
  <p>Invalid:
  00
  012345</p>
  
  <p>What I have so far:</p>
  
  <p><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>var regex = '^(?!00)([1-9][0-9]*)$';
  
  var testCases = ['0', '12345', '0123', '456', '12340', '00123'];
  
  for (var i in testCases) {
    var result = (testCases[i]).match(new RegExp(regex));
    
    var div = document.createElement('div');
    var textNode = document.createTextNode(testCases[i] + ': ' + !!result);
    div.append(textNode);
    document.querySelector('#results').appendChild(div);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id='results'&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The only thing missing (I feel) is passing for the only 0 case</p>