Ignore:
Timestamp:
Jun 22, 2012 2:25:43 PM (12 years ago)
Author:
anonymous
Message:

Updated email address validation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Email.inc.php

    r396 r399  
    9090        // The regex used in validEmail(). Set here instead of in the default _params above so we can use the concatenation . dot.
    9191        // This matches a (valid) email address as complex as:
    92         //      "Jane & Bob Smith" <bob&smith's/dep=sales!@smith-wick.ca.us> (Sales department)
     92        //      "Jane & Bob Smith" <bob&smith's/dep=sales!@smith-wick.ca.us > (Sales department)
    9393        // ...and something as simple as:
    9494        //      x@x.com
    95         $this->setParam(array('regex' => '/^(?:(?:"[^"]*?"\s*|[^,@]*)(<)|(?:"[^"]*?"|[^,@]*)\s+|)'   // Display name
     95        $this->setParam(array('regex' => '/^(?:(?:"[^"]*?"\s*|[^,@]*)(<\s*)|(?:"[^"]*?"|[^,@]*)\s+|)'   // Display name
    9696        . '((?:[^.<>\s@",\[\]]+[^<>\s@",\[\]])*[^.<>\s@",\[\]]+)'       // Local-part
    9797        . '@'                                                           // @
     
    102102        . '[.-]?(?:[A-Z0-9]+[-.])*(?:[A-Z0-9]+\.)+[A-Z]{2,6}))'         // FALSE, matches domain name
    103103        . '(?(1)'                                                       // Comment conditional for if initial < exists
    104         . '(?:>\s*|>\s+\([^,@]+\)\s*)'                                  // TRUE, ensure ending >
     104        . '(?:\s*>\s*|>\s+\([^,@]+\)\s*)'                                  // TRUE, ensure ending >
    105105        . '|'
    106106        . '(?:|\s*|\s+\([^,@]+\)\s*))$/i'));                            // FALSE ensure there is no ending >
Note: See TracChangeset for help on using the changeset viewer.