Skip to content

Commit

Permalink
Added a surrounding non-matching group, and accompanying test (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
lnpbk authored and ddeboer committed Mar 9, 2018
1 parent 47d23a8 commit b89c2ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function isValid($value, $checkExistence = false)
return false;
}

if (0 === preg_match('/^'.$this->patterns[$countryCode].'$/', $vatin)) {
if (0 === preg_match('/^(?:'.$this->patterns[$countryCode].')$/', $vatin)) {
return false;
}

Expand Down
1 change: 1 addition & 0 deletions tests/ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public function getInvalidVatins()
array(''),
array('123456789'),
array('XX123'),
array('GB999999973dsflksdjflsk'),
array('BE2999999999'), // Belgium - "the first digit following the prefix is always zero ("0") or ("1")"
);
}
Expand Down

0 comments on commit b89c2ff

Please sign in to comment.