1Regexp::Common::SEN(3)User Contributed Perl DocumentationRegexp::Common::SEN(3)
2
3
4
5       sub par11 {
6           my $string = shift;
7           my $sum    = 0;
8           for my $i (0 .. length ($string) - 1) {
9               my $c = substr ($string, $i, 1);
10               $sum += $c * (length ($string) - $i)
11           }
12           !($sum % 11) }
13
14       It's not clear whether this is the right checksum.
15
16       #
17       http://www.google.nl/search?q=cache:8m1zKNYrEO0J:www.enschede.nl/nieuw/pro‐
18       jecten/aanbesteding/integratie/pve%2520Bijlage%25207.5.doc+Sofi+num‐
19       mer+formaat&hl=en&start=56&lr=lang_en⎪lang_nl&ie=UTF-8 pattern name
20       => [qw /SEN Netherlands SoFi/],
21               create => sub {
22                   # 9 digits (d1 d2 d3 d4 d5 d6 d7 d8 d9)
23                   # 9*d1 + 8*d2 + 7*d3 + 6*d4 + 5*d5 + 4*d6 + 3*d7 + 2*d8 +
24       1*d9
25                   # == 0 mod 11.
26                   qr /([0-9]{9})(?(?{par11 ($^N)})⎪(?!))/;
27               }
28               ;
29

NAME

31       Regexp::Common::SEN -- provide regexes for Social-Economical Numbers.
32

SYNOPSIS

34        use Regexp::Common qw /SEN/;
35
36        while (<>) {
37            /^$RE{SEN}{USA}{SSN}$/    and  print "Social Security Number\n";
38        }
39

DESCRIPTION

41       Please consult the manual of Regexp::Common for a general description
42       of the works of this interface.
43
44       Do not use this module directly, but load it via Regexp::Common.
45
46       $RE{SEN}{USA}{SSN}{-sep}
47
48       Returns a pattern that matches an American Social Security Number
49       (SSN).  SSNs consist of three groups of numbers, separated by a hypen
50       ("-").  This pattern only checks for a valid structure, that is, it
51       validates whether a number is valid SSN, was a valid SSN, or maybe a
52       valid SSN in the future. There are almost a billion possible SSNs, and
53       about 400 million are in use, or have been in use.
54
55       If "-sep=P" is specified, the pattern P is used as the separator
56       between the groups of numbers.
57
58       Under "-keep" (see Regexp::Common):
59
60       $1  captures the entire SSN.
61
62       $2  captures the first group of digits (the area number).
63
64       $3  captures the second group of digits (the group number).
65
66       $4  captures the third group of digits (the serial number).
67

HISTORY

69        $Log: SEN.pm,v $
70        Revision 2.102  2005/01/02 01:17:48  abigail
71        - Removed 'use Carp', as we aren't using it.
72        - Outcommented unused 'par11' function. Ought to be in _support.pm anyway.
73
74        Revision 2.101  2004/06/09 21:52:14  abigail
75        Force 2.101 version
76
77        Revision 2.1  2004/06/09 21:50:14  abigail
78        Initial checkin
79

SEE ALSO

81       Regexp::Common for a general description of how to use this interface.
82

AUTHORS

84       Damian Conway and Abigail.
85

MAINTAINANCE

87       This package is maintained by Abigail (regexp-common@abigail.nl).
88

BUGS AND IRRITATIONS

90       Bound to be plenty.
91
92       For a start, there are many common regexes missing.  Send them in to
93       regexp-common@abigail.nl.
94
96                 Copyright (c) 2001 - 2003, Damian Conway and Abigail.
97               All Rights Reserved. This module is free software. It may
98               be used, redistributed and/or modified under the terms of
99                               the Perl Artistic License
100                   (see http://www.perl.com/perl/misc/Artistic.html)
101
102
103
104perl v5.8.8                       2003-03-23            Regexp::Common::SEN(3)
Impressum