note 73468 added to function.preg-match
| From: | nospam1 at piacitelli dot org | Date: | Sat, 24 Feb 2007 11:41:15 +0000 |
| Subject: | note 73468 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123816@lists.php.net to get a copy of this message | ||
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
----
Server IP: 69.147.83.197
Probable Submitter: 80.183.226.202
----
Manual Page -- http://www.php.net/manual/en/function.preg-match.php
Edit -- https://master.php.net/note/edit/73468
Del: integrated -- https://master.php.net/note/delete/73468/integrated
Del: useless -- https://master.php.net/note/delete/73468/useless
Del: bad code -- https://master.php.net/note/delete/73468/bad+code
Del: spam -- https://master.php.net/note/delete/73468/spam
Del: non-english -- https://master.php.net/note/delete/73468/non-english
Del: in docs -- https://master.php.net/note/delete/73468/in+docs
Del: other reasons-- https://master.php.net/note/delete/73468
Reject -- https://master.php.net/note/reject/73468
Search -- https://master.php.net/manage/user-notes.php