function testemail($emai l) {
$validEmailExpr =
"^[0-9a-z~!#$%&_-]([.]?[0-9a-z~!#$%&_-])*@[0-9a-z~!#$%&_-]([.]?[0-9a-z~!#$%&_-])*$";
return eregi($validEma ilExpr, $email);
}
$email = "foo@bar.gov.mi l";
testmail($email ); //return TRUE
$email = "foo.bar@bar.go v.mil";
testmail($email ); //return TRUE
$email = "foo..bar@bar.g ov.mil";
testmail($email ); //return FALSE - why ??
$email = "foo.@bar.gov.m il";
testmail($email ); //return FALSE - why ??
as i understand it : (steps)
1. accept only 1 char of group [0-9a-z~!#$%&_-]
2. require 0 or more chars of group ([.]?[0-9a-z~!#$%&_-])*
-- why foo..bar is not valid input ?,
-- shouldn't it be ([.]?[0-9a-z~!#$%&_-]*)* ?
thank you for your help.
p.s Sorry if my previous post "can i get the public key of client
machine using php" didn't fit right into USENET, i am very very new here
so go easy on me :)
Comment