title: Regex match number between 1 and 31 with or without leading 0
body: <p>I want to setup some validation on an <code>&lt;input&gt;</code> to prevent the user from entering wrong characters. For this I am using <code>ng-pattern</code>. It currently disables the user from entering wrong characters, but I also noticed this is not the expected behavior so I am also planning on creating a directive. </p>
  
  <hr>
  
  <p><strong>I am using</strong></p>
  
  <p>AngularJS: <em>1.6.1</em></p>
  
  <hr>
  
  <p><strong>What should the regex match</strong></p>
  
  <p>Below are the requirements for the regex string: </p>
  
  <ul>
  <li>Number 0x to xx (example 01 to 93)</li>
  <li>Number x to xx  (example 9 to 60)</li>
  <li>Characters are not allowed</li>
  <li>Special characters are not allowed</li>
  </ul>
  
  <p>Notice: 
  the 'x' is variable and could be any number between 0 and 100.</p>
  
  <p><em>The number on the place of 'x' is variable so if it is possible to create a string that is easily changeable that would be appreciated!</em></p>
  
  <hr>
  
  <p><strong>What I tried</strong></p>
  
  <p>A few regex strings I tried where: </p>
  
  <p>1) <code>^0*([0-9]\d{1,2})$</code> </p>
  
  <pre><code>--&gt; Does match 01 but not 1
  --&gt; Does match 32 where it shouldn't
  </code></pre>
  
  <p>2) <code>^[1-9][0-9]?$|^31$</code></p>
  
  <pre><code>--&gt; Does match 1 but not 01
  --&gt; Does match 32 where it shouldn't
  </code></pre>
  
  <hr>
  
  <p>For testing I am using <a href="https://regex101.com/tests" rel="noreferrer">https://regex101.com/tests</a>. </p>
  
  <p><strong>What am I missing in my attempts?</strong></p>