From 1ebc90c095244c5d4e61c334ea1a459abb6b47f4 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Tue, 14 Nov 2023 15:22:10 +0100 Subject: [PATCH] Stricter IE vat validation --- src/Validator.php | 2 +- tests/ValidatorTest.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Validator.php b/src/Validator.php index d276ba9..fc3e199 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -29,7 +29,7 @@ class Validator 'GB' => '(\d{9}|\d{12}|(GD|HA)\d{3})', 'HR' => '\d{11}', 'HU' => '\d{8}', - 'IE' => '([A-Z\d]{8}|[A-Z\d]{9})', + 'IE' => '((\d{7}[A-Z]{1,2})|(\d[A-Z]\d{5}[A-Z]))', 'IT' => '\d{11}', 'LT' => '(\d{9}|\d{12})', 'LU' => '\d{8}', diff --git a/tests/ValidatorTest.php b/tests/ValidatorTest.php index 1381327..847bc49 100644 --- a/tests/ValidatorTest.php +++ b/tests/ValidatorTest.php @@ -39,6 +39,8 @@ public function testValidateVatNumberFormat() 'HU12345678', 'HR12345678901', 'IE1234567X', + 'IE1X34567X', + 'IE1234567XX', 'IT12345678901', 'LT123456789', 'LU12345678', @@ -78,6 +80,9 @@ public function testValidateVatNumberFormat() 'HU1234567', 'HR1234567890', 'IE123456X', + 'IE1X34567XX', + 'IE12345678X', + 'IE123456789', 'IT1234567890', 'LT12345678', 'LU1234567',