RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^([GB])*(([1-9]\d{8})|([1-9]\d{11}))$
Description
Simple check of valid UK VAT Registration numbers. The standard format for UK VAT number must be 9 characters long or 12 characters if a branch trader. The GB prefix has been included as optional, but technically you should include it. The UK VAT format also includes Government Departments and Health Authorities, but I have excluded them for the moment.
Matches
123456789 | GB123456789 | GB123456789123
Non-Matches
dfddf | 3443443 | 34 34 3344
Author Rating: Not yet rated. Ben Powell
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: improvement on the base version
Name: Fabrizio Moscon
Date: 1/7/2013 7:19:34 AM
Comment:
^(GB)?([0-9]{9}|[0-9]{12}|(GD|HA)[0-9]{3})$ # Standard '123456789', 'GB123456789', 'GB999 9999 73', # Branch Traders '123456789123', 'GB123456789123', # Govt Departments 'GD999', 'GBGD999', # Health Authorities 'HA999', 'GBHA999', # Tesco 'GB220430231'


Title: EC Vat Number Layout
Name: Giles Hyde
Date: 11/12/2010 4:33:30 AM
Comment:
Very useful - many thanks :)


Title: EC Vat Number Layout
Name: Geoff Tyrer
Date: 1/12/2010 8:06:27 AM
Comment:
The EC has created a Taxation and Customs web site and this provides the VAT Number layout specifications of all EC countries. At the time of writing it can be found at: http://ec.europa.eu/taxation_customs/vies/faqvies.do#item14 - scroll down to Question 11. The layout specification they give for the UK is: GB999 9999 99 (regular) GB999 9999 99 999 (branch traders) GBGD999 (government departments GBHA999 (health authorities) Geoff Tyrer ViziGenHC


Title: EC Vat Number Layout
Name: Geoff Tyrer
Date: 1/12/2010 8:03:44 AM
Comment:
The EC has created a Taxation and Customs web site and this provides the VAT Number layout specifications of all EC countries. At the time of writing it can be found at: http://ec.europa.eu/taxation_customs/vies/faqvies.do#item14 - scroll down to Question 11. The layout specification they give for the UK is: GB999 9999 99 (regular) GB999 9999 99 999 (branch traders) GBGD999 (government departments GBHA999 (health authorities) Geoff Tyrer ViziGenHC


Title: EC Vat Number Layout
Name: Geoff Tyrer
Date: 1/12/2010 8:03:29 AM
Comment:
The EC has created a Taxation and Customs web site and this provides the VAT Number layout specifications of all EC countries. At the time of writing it can be found at: http://ec.europa.eu/taxation_customs/vies/faqvies.do#item14 - scroll down to Question 11. The layout specification they give for the UK is: GB999 9999 99 (regular) GB999 9999 99 999 (branch traders) GBGD999 (government departments GBHA999 (health authorities) Geoff Tyrer ViziGenHC


Title: Ooops!
Name: Ben Powell
Date: 12/6/2005 6:38:11 AM
Comment:
Sorry that should be: ^([GB])*(([1-9]\d{8})|([1-9]\d{11}))$ Apologies, got my digits counts wrong. Indexing starts at ZERO!


Title: Minor UK VAT format styles
Name: Ben Powell
Date: 12/6/2005 6:06:00 AM
Comment:
Colin Perry is indeed correct. As well as this, the VAT number should be prefixed by GB. The UK format for VAT numbers also includes seperate formats for branch traders (GB123 4567 89 123), government departments and health authorities. ^([GB])*(([1-9]\d{9})|([1-9]\d{12}))$ The regex above would cure the basic woes, though I am guessing that Customs & Excise could be strict on the spacing too. The above example does not provide for the other minor formats.


Title: Doesn't catch all UK VAT nos
Name: Colin Perry
Date: 3/12/2005 12:17:04 PM
Comment:
Works well... but a few UK VAT numbers are 12 digits long.


Copyright © 2001-2018, RegexAdvice.com | ASP.NET Tutorials