Hi there
Can someone supply with a PHP code that checks whether a given PHP string
constitutes a legal email address in terms of the syntax?
I am sure regular expressions are the way to go.
I found the following solution:
Hi
Hi
function isValidEmailSyntax($email) {
if(ereg("^([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])*$",$email)) {
return true;
} else {
return false;
}
}
But when I pass the value 'nuwan@yahoo.com' it says that the email address is NOT valid.
Does that sound right?
Can anyone see the bug in the function?
-- This message may have been cut off and the rest will only be shown to members. To become a member, click here --