Skip to content

Instantly share code, notes, and snippets.

@marcinlerka
Created August 23, 2017 09:40
Show Gist options
  • Save marcinlerka/630cc05d11bb10c5f1904506ff92abcd to your computer and use it in GitHub Desktop.
Save marcinlerka/630cc05d11bb10c5f1904506ff92abcd to your computer and use it in GitHub Desktop.
eu vat numbers regex
'AT': (/^(AT)(U\d{8}$)/i), // Austria
'BE': (/^(BE)(\d{10}$)/i), // Belgium
'BG': (/^(BG)(\d{9,10}$)/i), // Bulgaria
'CY': (/^(CY)([0-5|9]\d{7}[A-Z]$)/i), // Cyprus
'CZ': (/^(CZ)(\d{8,10})?$/i), // Czech Republic
'DE': (/^(DE)([1-9]\d{8}$)/i), // Germany
'DK': (/^(DK)(\d{8}$)/i), // Denmark
'EE': (/^(EE)(10\d{7}$)/i), // Estonia
'EL': (/^(EL)(\d{9}$)/i), // Greece
'ES': (/^(ES)([0-9A-Z][0-9]{7}[0-9A-Z]$)/i), // Spain
'EU': (/^(EU)(\d{9}$)/i), // EU-type
'FI': (/^(FI)(\d{8}$)/i), // Finland
'FR': (/^(FR)([0-9A-Z]{2}[0-9]{9}$)/i), // France
'GB': (/^(GB)((?:[0-9]{12}|[0-9]{9}|(?:GD|HA)[0-9]{3})$)/i), // UK (Standard = 9 digits), (Branches = 12 digits), (Government = GD + 3 digits), (Health authority = HA + 3 digits)
'GR': (/^(GR)(\d{8,9}$)/i), // Greece
'HR': (/^(HR)(\d{11}$)/i), // Croatia
'HU': (/^(HU)(\d{8}$)/i), // Hungary
'IE': (/^(IE)([0-9A-Z\*\+]{7}[A-Z]{1,2}$)/i), // Ireland
'IT': (/^(IT)(\d{11}$)/i), // Italy
'LV': (/^(LV)(\d{11}$)/i), // Latvia
'LT': (/^(LT)(\d{9}$|\d{12}$)/i), // Lithunia
'LU': (/^(LU)(\d{8}$)/i), // Luxembourg
'MT': (/^(MT)([1-9]\d{7}$)/i), // Malta
'NL': (/^(NL)(\d{9}B\d{2}$)/i), // Netherlands
'NO': (/^(NO)(\d{9}$)/i), // Norway (not EU)
'PL': (/^(PL)(\d{10}$)/i), // Poland
'PT': (/^(PT)(\d{9}$)/i), // Portugal
'RO': (/^(RO)([1-9]\d{1,9}$)/i), // Romania
'RU': (/^(RU)(\d{10}$|\d{12}$)/i), // Russia
'RS': (/^(RS)(\d{9}$)/i), // Serbia
'SI': (/^(SI)([1-9]\d{7}$)/i), // Slovenia
'SK': (/^(SK)([1-9]\d[(2-4)|(6-9)]\d{7}$)/i), // Slovakia Republic
'SE': (/^(SE)(\d{10}01$)/i) // Sweden
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment