protected static function matchRule($postalCode, $rule)
    {
        if (substr($rule, 0, 1) == '/' && substr($rule, -1, 1) == '/') {
            $match = preg_match($rule, $postalCode);
        } else {
            $match = in_array($postalCode, self::buildList($rule));
        }

        return $match;
    }
protected static function matchRule($postalCode, $rule)
    {
        if (substr($rule, 0, 1) == '/' && substr($rule, -1, 1) == '/') {
            $match = preg_match($rule, $postalCode);
        } else {
            $match = in_array($postalCode, self::buildList($rule));
        }

        return $match;
    }
protected static function matchRule ( $ postalCode , $ rule ) { if ( substr ( $ rule , 0 , 1 ) == '/' && substr ( $ rule , - 1 , 1 ) == '/' ) { $ match = preg_match ( $ rule , $ postalCode ) ; } else { $ match = in_array ( $ postalCode , self :: buildList ( $ rule ) ) ; } return $ match ; }
Checks whether the provided postal code matches the provided rule.

@param string $postalCode The postal code.
@param string $rule       The rule. Can be a regular expression
("/(35|38)[0-9]{3}/") or comma-separated list,
including ranges ("98, 100:200, 250").

@return bool True if the provided postal code matches the provided
rules, false otherwise.
Checks whether the provided postal code matches the provided rule .