Ignore:
Timestamp:
2009/10/29 16:04:23 (14 years ago)
Author:
shutta
Message:

EMAIL_CHECK関数の正規表現を改良

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/class/SC_CheckError.php

    r18251 r18352  
    518518        } 
    519519        $this->createParam($value); 
    520         if(strlen($this->arrParam[$value[1]]) > 0 && !ereg("^[^@]+@[^.^@]+\..+", $this->arrParam[$value[1]])) { 
     520 
     521        $wsp           = '[\x20\x09]'; 
     522        $vchar         = '[\x21-\x7e]'; 
     523        $quoted_pair   = "\\\\(?:$vchar|$wsp)"; 
     524        $qtext         = '[\x21\x23-\x5b\x5d-\x7e]'; 
     525        $qcontent      = "(?:$qtext|$quoted_pair)"; 
     526        $quoted_string = "\"$qcontent*\""; 
     527        $atext         = '[a-zA-Z0-9!#$%&\'*+\-\/\=?^_`{|}~]'; 
     528        $dot_atom_text = "$atext+(?:[.]$atext+)*"; 
     529        $dot_atom      = $dot_atom_text; 
     530        $local_part    = "(?:$dot_atom|$quoted_string)"; 
     531        $domain        = $dot_atom; 
     532        $addr_spec     = "${local_part}[@]$domain"; 
     533 
     534        $regexp = "/\A${addr_spec}\z/"; 
     535 
     536        if(strlen($this->arrParam[$value[1]]) > 0 && !preg_match($regexp, $this->arrParam[$value[1]])) { 
    521537            $this->arrErr[$value[1]] = "※ " . $value[0] . "の形式が不正です。<br />"; 
    522538        } 
Note: See TracChangeset for help on using the changeset viewer.