title: (How-to) JavaScript - Test for Unsigned Integer (UINT) using Regular Expressions (RegExp)
body: <p><strong>Problem</strong>: How to test/check if a value is an Unsigned Integer (<em>UINT</em>) in <strong><em>JavaScript</em></strong>.</p>
  
  <p><strong>Alternative Answers</strong>:
  Thanks goes to the following for improving this answer!</p>
  
  <p>@<strong>jbabey</strong>:<code>if Number(val) > 0</code></p>
  
  <p>@<strong>SLaks</strong>:<code>if (/^\d+$/.test(someString))</code></p>
  
  <hr>
  
  <p><strong>About</strong>: This shows how to test/check if a value is an Unsigned Integer (<em>UINT</em>) in <strong><em>JavaScript</em></strong>.</p>
  
  <hr>
  
  <p><strong>Usage</strong>: <code>JS: isUINT( value );</code></p>
  
  <hr>
  
  <p><strong>Returns</strong>: <code>True</code> <em>OR</em> <code>False</code></p>
  
  <hr>
  
  <p><strong>Expanded Version</strong>:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function isUINT(v)
      {
          var r = RegExp(/(^[^\-]{0,1})?(^[\d]*)$/);
          return r.test(v) &amp;&amp; v.length &gt; 0;
      }
  &lt;/script&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>Minified Version</strong>:</p>
  
  <pre><code>function isUINT(v){var r=RegExp(/(^[^\-]{0,1})?(^[\d]*)$/);return r.test(v)&amp;&amp;v.length&gt;0}
  </code></pre>
  
  <hr>
  
  <p><em>Comments / Alternatives are Welcomed!</em></p>