Changeset 2201

Show
Ignore:
Timestamp:
02/29/2008 04:41:00 PM (9 months ago)
Author:
Geert
Message:

Replaced PHP's email filter with a faster and more accurate regex. For more information about my regex, check out: http://fightingforalostcause.net/misc/2006/compare-email-regex.php

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/helpers/valid.php

    r2032 r2201  
    2020        public static function email($email) 
    2121        { 
    22                 return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); 
     22                return (bool) preg_match('/^[-_a-z0-9\'+*$^&%=~!?{}]++(?:\.[-_a-z0-9\'+*$^&%=~!?{}]+)*+@(?:(?![-.])[-a-z0-9.]+(?<![-.])\.[a-z]{2,6}|\d{1,3}(?:\.\d{1,3}){3})(?::\d++)?$/iD', $email); 
    2323        } 
    2424