I concur, that's a pretty sorry regex for email matching you could get away with murder on that, in fact this string
@.
would work :-~ - and it would fail for domains like @sub.domain.com
"/[@]@[@].[@]*$/" basically means:
start of string
anything besides @ "maybe"
an @
anything besides @ "maybe"
one period
anything besides @ "maybe"
yuck..
here's what I use:
function valid_email($x){
if(preg_match('/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/',$x))return true;
return false;
}