Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Email syntax check (See related posts)

// Email syntax check

<?php
function check_email($email)
{
    $atom = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]'; // znaky tvořící uživatelské jméno
    $domain = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])'; // jedna komponenta domény
    return eregi("^$atom+(\\.$atom+)*@($domain?\\.)+$domain\$", $email);
}
?>

Comments on this post

logankoester posts on Sep 14, 2006 at 05:49
Thank you! My server was being attacked (I got lazy and didn't bother to check some form data before inserting it to the db) and needed an email regex fast, and you were here. :)

Saved the day, mate.

You need to create an account or log in to post comments to this site.


Click here to browse all 5141 code snippets

Related Posts