Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix: correct French VAT (FR) validation regex and add tests
  • Loading branch information
iamAmer committed Aug 27, 2025
commit 1fa4aa45b793d0c9f5cf9229ad6d94e2c314bb27
2 changes: 1 addition & 1 deletion src/lib/isVAT.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const vatMatchers = {
DK: str => /^(DK)?\d{8}$/.test(str),
EE: str => /^(EE)?\d{9}$/.test(str),
FI: str => /^(FI)?\d{8}$/.test(str),
FR: str => /^(FR)?\w{2}\d{9}$/.test(str),
FR: str => /^(FR)([A-Z0-9]{2}\d{9})$/.test(str),
DE: str => /^(DE)?\d{9}$/.test(str),
EL: str => /^(EL)?\d{9}$/.test(str),
HU: str => /^(HU)?\d{8}$/.test(str),
Expand Down
9 changes: 8 additions & 1 deletion test/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15055,11 +15055,18 @@ describe('Validators', () => {
args: ['FR'],
valid: [
'FRAA123456789',
'AA123456789',
'FR83404833048',
'FR40123456789',
'FRA1123456789',
'FR1A123456789',
],
invalid: [
'FR AA123456789',
'123456789',
'FRAA123456789A',
'FR123456789',
'FR 83404833048',
'FRaa123456789',
],
});
test({
Expand Down