Return to Snippet

Revision: 64745
at September 14, 2013 10:26 by phpdev


Initial Code
/**
 * @title            Check if it is a valid and university email address.
 * 
 * @author           Pierre-Henry Soria <[email protected]>
 * @copyright        (c) 2013, Pierre-Henry Soria. All Rights Reserved.
 * @param            string $sEmail
 * @return           boolean
 */
function isUniversityEmail($sEmail)
{
    return preg_match('/^[a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+edu$/i', $sEmail);
}

Initial URL

                                

Initial Description
**Example of use:**
    
    if (!isUniversityEmail('[email protected]'))
         exit('You must have a valid and .edu email address to register for an account.');

Initial Title
Check University Email (.edu)

Initial Tags
regex, email, mail, security

Initial Language
PHP