使用strpos验证联系表格中的邮政编码7

I believe what I'm trying to do is quite simple but I'm still a bit of a novice when it comes to PHP and struggling to get some fairly simple validation up and running in Contact Form 7.

Basically I have a client that only delivers to certain postal codes in Ontario, Canada. The first phase of the checkout process is an email capture form that also asks for the users postal code to check if there are in the delivery area.

The postal codes are 3 character strings:

  • L6A
  • N4K
  • K1Y
  • K4C
  • K6V
  • etc.

I've been able to write a simple validation against one of the regions (e.g. L6A) but I'm not sure how I can check the user submitted value against the entire list of postal codes as well as have it NOT be case sensitive.

My code is below:

function custom_text_validation_filter($result, $tag) {  
      $type = $tag['type'];  
      $name = $tag['name'];
      $needle = 'L6A';

      //here textbox type name is 'postal-code'
      if($name == 'postal-code') { 
          $value = $_POST[$name];  
          $pos = strpos($value, $needle);
          if ($pos === false){
            $result->invalidate( $tag, "Does Not Contain L6A" );
          } 
      } 
      return $result;  
}
add_filter('wpcf7_validate_text','custom_text_validation_filter', 10, 2); 
add_filter('wpcf7_validate_text*', 'custom_text_validation_filter', 10, 2); 

I'm hoping to have a validation that provides a message when the form doesn't validate like "Sorry, you're not in our delivery area" and redirects users to a URL when their postal code is on the list.

Any help would be amazing :)