title: PO Box Validation
body: <p>Looking to validate PO Box but wanted to know if such validation existed. I have the Address field split into Address 1 and Address 2 (Where such PO, Apt, Suite info would go)</p>
  <p>Example:</p>
  <pre><code>Address 1: 123 Main Street
  Address 2: Suite 100
  City: Any Town      
  State: Any State
  Zip: Any Zip
  </code></pre>
  <p>PO Box (Can sub BIN for BOX as well) Examples:</p>
  <ul>
  <li>PO Box 123</li>
  <li>P.O. Box 123</li>
  <li>PO 123</li>
  <li>Post Office Box 123</li>
  <li>P.O 123</li>
  <li>Box 123</li>
  <li><h1>123</h1>
  </li>
  <li>123</li>
  <li>POB 123</li>
  <li>P.O.B 123</li>
  <li>P.O.B. 123</li>
  <li>Post 123</li>
  <li>Post Box 123</li>
  </ul>
  <p>(I know there are probably more I need to validate for but this is what I could think of, feel free to add or correct)</p>
  <p>I know a RegEx would be best for this and I've seen the other questions on Stack <a href="https://stackoverflow.com/questions/4564004/negating-regex-po-box">#1</a>, <a href="https://stackoverflow.com/questions/1228287/post-box-bin-validation">#2</a></p>
  <p>Using the RegEx from the other question I get good results but it misses some I think it should catch</p>
  <pre><code>$arr = array (
      'PO Box 123',
      'P.O. Box 123',
      'PO 123',
      'Post Office Box 123',
      'P.O 123',
      'Box 123',
      '#123',         // no match
      '123',          // no match
      'POB 123',
      'P.O.B 123',    // no match
      'P.O.B. 123',   // no match
      'Post 123',     // no match
      'Post Box 123'  // no match
  );
  
  foreach($arr as $po) {
      if(preg_match(&quot;/^\s*((P(OST)?.?\s*O(FF(ICE)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i&quot;, $po)) {
          echo &quot;A match was found: $po\n&quot;;
      } else {
          echo &quot;A match was not found: |$po| \n&quot;;
      }
  }
  </code></pre>
  <p>Why is it not catching the last two values in the array?</p>