The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Regexp::Common::VATIN - Patterns for matching EU VAT Identification Numbers

SYNOPSIS

    use feature qw(say);
    use Regexp::Common qw(VATIN);
    say "DE123456789" =~ $RE{VATIN}{DE};  # 1
    say "DE123456789" =~ $RE{VATIN}{any}; # 1
    say "LT123ABC"    =~ $RE{VATIN}{LT};  # ""

DESCRIPTION

This module provides regular expression patterns to match any of the sanctioned VATIN formats from the 27 nations levying a European Union value added tax. The data found at http://ec.europa.eu/taxation_customs/vies/faq.html#item_11 is used as the authoritative source of all patterns.

JAVASCRIPT

All patterns in this module are written to be compatible with JavaScript's somewhat less-expressive regular expression standard. They can thus easily be exported for use in a browser-facing web application:

    use JSON qw(encode_json);
    my $patterns = encode_json($RE{VATIN});

CAVEAT

In keeping with the standard set by the core Regexp::Common modules, patterns are neither anchored nor enclosed with word boundaries. Consider a malformed VATIN, e.g.,

    my $vatin = "GB1234567890";

According to the sanctioned patterns from the United Kingdom, the above VATIN is malformed (one digit too many). And yet,

    say $vatin =~ $RE{VATIN}{GB};     # 1

To test for an exact match, use start and end anchors:

    say $vatin =~ /^$RE{VATIN}{GB}$/; # ""

SEE ALSO

Regexp::Common

For documentation of the interface this set of regular expressions uses.

Business::Tax::VAT::Validation

Checks the official EU database for registered VATINs.

AUTHOR

Richard Simões <rsimoes AT cpan DOT org>

COPYRIGHT AND LICENSE

Copyright © 2013 Richard Simões. This module is released under the terms of the MIT License and may be modified and/or redistributed under the same or any compatible license.