I have the following Javascript in my PHP site.
The problem is that the regexp doesnt allow
email addresses with spaces before or after the email.
how would i have to change it for example it doesnt accept:
"daniel@imcworld.com " excluding the quotations
<script language="javascript">
function validEmail() {
var re = new RegExp();
re = /\w+([.-]?\w+)@\w+([.-]?\w+)(.\w{2,3})+$/;
if(document.register.emailis.value == "") {
alert("You have to use an email address");
}
if(!re.test(document.register.emailis.value)){
alert("Your email is incorrect. Make sure there are no spaces");
}else{
document.register.submit();
}
}
</script>