I have the same expression in Javascript but it won’t work in PHP for server side validation. Here’s the code
if (ereg('/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\\.([a-zA-Z])+([a-zA-Z])+/',$_POST['email-address'])) echo 'valid email'; else echo 'invalid email';
use preg_match, not ereg. ereg regex strings do not use an enclosing slash character.
Also the double-backslash may not be necessary in a single-quoted string in PHP (not sure about that, though)