title: regex - tracking numbers 2018
body: <p>I created a new thread referencing this thread, which is 9 years old :</p>
  
  <p>(<a href="https://stackoverflow.com/questions/619977/regular-expression-patterns-for-tracking-numbers">Regular Expression patterns for Tracking numbers</a>)</p>
  
  <p>My question here, at the moment, resolves around the format of the UPS tracking number. According to UPS.com, the format for the tracking numbers with 1Z should be 1Z + 6 characters (numbers or letters) + 2 characters (numbers or letters) + 8 characters (numbers or letters), example format: <code>1Z 89X406 C8 33660056</code>, however in the example for UPS, referenced in the thread link above, the matching format is centered around: <code>1Z 89S 406 B8 3322 005 6</code></p>
  
  <p>In the second matching format, the pattern used is:</p>
  
  <pre><code>\b(1Z ?[0-9A-Z]{3} ?[0-9A-Z]{3} ?[0-9A-Z]{2} ?[0-9A-Z]{4} ?[0-9A-Z]{3} ?[0-9A-Z]
  </code></pre>
  
  <p>but, you could also use this pattern (to match the first format, according to UPS quote on quote proper format): <code>\b(1Z ?[0-9A-Z]{6} ?[0-9A-Z]{2} ?[0-9A-Z]{8}</code></p>
  
  <p>I guess the question I have boils down to whether there is efficiency in using either matching pattern over the other. I'm not understanding why the OP of the link above uses the second matching pattern instead of the one that conforms to the format of the UPS tracking number.</p>
  
  <p>Thanks in advance, and hope this helps someone else in the future.</p>