note 73468 deleted from function.preg-match by colder
| From: | colder@php.net | Date: | Mon, 18 Jun 2007 18:34:31 +0000 |
| Subject: | note 73468 deleted from function.preg-match by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127642@lists.php.net to get a copy of this message | ||
Note Submitter: nospam1 at piacitelli dot org
----
Concerning note by warcraft at libero dot it , 20-Jul-2006 07:29.
The proposed code for checking the "codice fiscale" (italian fiscal ID) could rule out
valid submissions.
Indeed, issued "codici fiscali" may be modified by the goverment in case of persons with
same name birthday and birthplace, by turning one or more of the seven numbers into letters
respecting the correspondence
0123456789 - LMNPQRSTUV.
Hence the correct code to check a submitted "codice fiscale" is the following
modification of warcraft's code:
$cf='/[a-z]{6}[0-9lmnpqrstuv]{2}[abcdehlmprst][0-9lmnpqrstuv]{2}'._
'[a-z][0-9lmnpqrstuv]{3}[a-z]/i";
return preg_match($cf,$var);
namely:
- there are 16 characters
- characters at positions (count start from 1) from 1-6, 9, 12 and 16
are in [a-z];
- all other characters are in [0-9lmnpqrstuv]
Gherardo