Just tested this function to validate an email..However,it does not validate the presence or absence of the dot in the email..Why this is happening and how can I fix this?
<script type="text/javascript">
function isEmail(textbox){
var reg4 =/^(\w+)@(\w+).(\w+)$/;
if(reg4.test(textbox.value)){
return true;
}
return false;
}
</script>
No, it’s insufficient.
In particular, it doesn’t handle all these (legal) variants:
quoted user parts, e.g. "my name"@example.com
Internationalised domain names (IDNs)
Domains with more than two labels
Domains with only one label (yes, those are legal)
Hyphens in domain names
user@[1.2.3.4]Validating an e-mail address via a regexp is very hard. See section 3.4.1 of RFC 5322 for the formal syntax definition.