From f73ab637fc054a56360568914b863c1256f7e684 Mon Sep 17 00:00:00 2001 From: Krzysztof Grabania Date: Wed, 19 Oct 2016 15:48:13 +0200 Subject: [PATCH] Added polish postcode validation --- includes/class-wc-validation.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/class-wc-validation.php b/includes/class-wc-validation.php index 39e0df1ae36..57afd384a82 100644 --- a/includes/class-wc-validation.php +++ b/includes/class-wc-validation.php @@ -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 $valid = (bool) preg_match( '/^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ])([\ ])?(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$/i', $postcode ); break; + case 'PL': + $valid = (bool) preg_match( '/^([0-9]{2})([-])([0-9]{3})$/', $postcode ); + break; default : $valid = true;