title: Anyone see anything wrong with my regex for port numbers?
body: <p>I made a regex for port numbers (before you say this is a bad idea, its going into a bigger regex for URL's which is much harder than it sounds).</p>
  
  <p>My coworker said this is really bad and isn't going to catch everything. I disagree.</p>
  
  <p>I believe this thing catches everything from 0 to 65535 and <em>nothing else,</em> and I'm looking for confirmation of this.</p>
  
  <p>Single-line version (for computers):</p>
  
  <pre><code>/(^[0-9]$)|(^[0-9][0-9]$)|(^[0-9][0-9][0-9]$)|(^[0-9][0-9][0-9][0-9]$)|((^[0-5][0-9][0-9][0-9][0-9]$)|(^6[0-4][0-9][0-9][0-9]$)|(^65[0-4][0-9][0-9]$)|(^655[0-2][0-9]$)|(^6553[0-5]$))/
  </code></pre>
  
  <p>Human readable version:</p>
  
  <pre><code>/(^[0-9]$)|                           # single digit
   (^[0-9][0-9]$)|                      # two digit
   (^[0-9][0-9][0-9]$)|                 # three digit
   (^[0-9][0-9][0-9][0-9]$)|            # four digit
   ((^[0-5][0-9][0-9][0-9][0-9]$)|      # five digit (up to 59999)
    (^6[0-4][0-9][0-9][0-9]$)|          #            (up to 64999)
    (^65[0-4][0-9][0-9]$)|              #            (up to 65499)
    (^655[0-2][0-9]$)|                  #            (up to 65529)
    (^6553[0-5]$))/                     #            (up to 65535)
  </code></pre>
  
  <p>Can someone confirm that my understanding is correct (or otherwise)?</p>