Skip to content

Commit 905499c

Browse files
Merge pull request #63 from weglot/fix/ie-vat
Stricter IE vat validation
2 parents 7f18ad4 + 1ebc90c commit 905499c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Validator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Validator
2929
'GB' => '(\d{9}|\d{12}|(GD|HA)\d{3})',
3030
'HR' => '\d{11}',
3131
'HU' => '\d{8}',
32-
'IE' => '([A-Z\d]{8}|[A-Z\d]{9})',
32+
'IE' => '((\d{7}[A-Z]{1,2})|(\d[A-Z]\d{5}[A-Z]))',
3333
'IT' => '\d{11}',
3434
'LT' => '(\d{9}|\d{12})',
3535
'LU' => '\d{8}',

tests/ValidatorTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public function testValidateVatNumberFormat()
3939
'HU12345678',
4040
'HR12345678901',
4141
'IE1234567X',
42+
'IE1X34567X',
43+
'IE1234567XX',
4244
'IT12345678901',
4345
'LT123456789',
4446
'LU12345678',
@@ -78,6 +80,9 @@ public function testValidateVatNumberFormat()
7880
'HU1234567',
7981
'HR1234567890',
8082
'IE123456X',
83+
'IE1X34567XX',
84+
'IE12345678X',
85+
'IE123456789',
8186
'IT1234567890',
8287
'LT12345678',
8388
'LU1234567',

0 commit comments

Comments
 (0)