Merge pull request #12134 from Dartui/patch-1

Added polish postcode validation
This commit is contained in:
Claudio Sanches 2016-10-19 13:24:41 -02:00 committed by GitHub
commit d75daa23f0
1 changed files with 3 additions and 0 deletions

View File

@ -83,6 +83,9 @@ class WC_Validation {
// CA Postal codes cannot contain D,F,I,O,Q,U and cannot start with W or Z. https://en.wikipedia.org/wiki/Postal_codes_in_Canada#Number_of_possible_postal_codes // CA Postal codes cannot contain D,F,I,O,Q,U and cannot start with W or Z. https://en.wikipedia.org/wiki/Postal_codes_in_Canada#Number_of_possible_postal_codes
$valid = (bool) preg_match( '/^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ])([\ ])?(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$/i', $postcode ); $valid = (bool) preg_match( '/^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ])([\ ])?(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$/i', $postcode );
break; break;
case 'PL':
$valid = (bool) preg_match( '/^([0-9]{2})([-])([0-9]{3})$/', $postcode );
break;
default : default :
$valid = true; $valid = true;